nytlabs / gojee Goto Github PK
View Code? Open in Web Editor NEWJSON expression evaluator
License: Other
JSON expression evaluator
License: Other
$~bool(.a) == true ? "yes" : "no"
gojee should accept script such as {"a": .A}
or [.a,.b,.c]
as part of its native syntax
on recieving ints:
panic: interface conversion: interface is int, not float64
goroutine 1811 [running]:
runtime.panic(0x3cfca0, 0xc2102689c0)
/usr/local/go/src/pkg/runtime/panic.c:266 +0xb6
github.com/nytlabs/gojee.func·030(0x316260, 0xc2102cd580, 0xc2102c3590, 0x4, 0xc21005d4e8, ...)
/Users/mikedewar/go/src/github.com/nytlabs/gojee/jee.go:622 +0xb9
github.com/nytlabs/gojee.Eval(0xc2102e7000, 0x327ee0, 0xc21009aea0, 0x21609, 0xc2102c36b0, ...)
/Users/mikedewar/go/src/github.com/nytlabs/gojee/jee.go:1089 +0x2661
github.com/nytlabs/gojee.Eval(0xc2102b9180, 0x327ee0, 0xc21009aea0, 0xc2102b9180, 0xc210239901, ...)
/Users/mikedewar/go/src/github.com/nytlabs/gojee/jee.go:1112 +0x2d24
github.com/nytlabs/streamtools/st/library.evalMap(0xc2101f9c90, 0xc21009aea0, 0xc2101f9c90, 0xc2101f9c90, 0x329020)
/Users/mikedewar/go/src/github.com/nytlabs/streamtools/st/library/map.go:62 +0x2bd
github.com/nytlabs/streamtools/st/library.(*Map).Run(0xc21014cbb0)
/Users/mikedewar/go/src/github.com/nytlabs/streamtools/st/library/map.go:154 +0x57c
created by github.com/nytlabs/streamtools/st/blocks.BlockRoutine
/Users/mikedewar/go/src/github.com/nytlabs/streamtools/st/blocks/blocks.go:202 +0xef
To recreate in streamtools:
{
"Connections": [
{
"ToRoute": "poll",
"ToId": "2",
"FromId": "5",
"Id": "6"
},
{
"ToRoute": "in",
"ToId": "3",
"FromId": "2",
"Id": "7"
},
{
"ToRoute": "in",
"ToId": "4",
"FromId": "3",
"Id": "8"
},
{
"ToRoute": "poll",
"ToId": "4",
"FromId": "9",
"Id": "10"
}
],
"Blocks": [
{
"Position": {
"Y": 646,
"X": 370
},
"Rule": {
"Map": {
"foo": "$max(.Histogram[].Count)"
},
"Additive": true
},
"Type": "map",
"Id": "1"
},
{
"Position": {
"Y": 247,
"X": 355
},
"Rule": {
"Rate": 1
},
"Type": "poisson",
"Id": "2"
},
{
"Position": {
"Y": 378,
"X": 411
},
"Rule": {
"Map": {
"sample": "$str(.sample)"
},
"Additive": true
},
"Type": "map",
"Id": "3"
},
{
"Position": {
"Y": 511,
"X": 436
},
"Rule": {
"Window": "10s",
"Path": ".sample"
},
"Type": "histogram",
"Id": "4"
},
{
"Position": {
"Y": 153,
"X": 309
},
"Rule": {
"Interval": "1s"
},
"Type": "ticker",
"Id": "5"
},
{
"Position": {
"Y": 404,
"X": 575
},
"Rule": {
"Interval": "1s"
},
"Type": "ticker",
"Id": "9"
}
]
}
unexpected fault address 0x0
fatal error: fault
[signal 0xb code=0x80 addr=0x0 pc=0x40708e]
goroutine 3186217 [running]:
[fp=0x7f2d386dc380] runtime.throw(0x941e97)
/usr/lib/go/src/pkg/runtime/panic.c:473 +0x67
[fp=0x7f2d386dc398] runtime.sigpanic()
/usr/lib/go/src/pkg/runtime/os_linux.c:239 +0xe7
[fp=0x7f2d386dc400] runtime.mapaccess1_faststr()
/usr/lib/go/src/pkg/runtime/hashmap.c:458 +0x2de
[fp=0x7f2d386dc6b8] github.com/nytlabs/gojee.getKeyValues(0xc201214fc0, 0x655840, 0xc2008fac00, 0xc2002a58d1, 0x7, ...)
/home/ubuntu/go/src/github.com/nytlabs/gojee/jee.go:758 +0x1a4
[fp=0x7f2d386dcf80] github.com/nytlabs/gojee.Eval(0xc201214fc0, 0x655840, 0xc2008fac00, 0xc2002574b8, 0x2, ...)
/home/ubuntu/go/src/github.com/nytlabs/gojee/jee.go:964 +0x322a
----- stack segment boundary -----
[fp=0x7f2d39f55f80] github.com/nytlabs/gojee.Eval(0xc200e32040, 0x655840, 0xc2008fac00, 0x65e300, 0x7f2d3865d600, ...)
/home/ubuntu/go/src/github.com/nytlabs/gojee/jee.go:873 +0x758
----- stack segment boundary -----
[fp=0x7f2d386f2de0] github.com/nytlabs/gojee.Eval(0xc201214f80, 0x655840, 0xc2008fac00, 0xc2008fac00, 0xc2007f1578, ...)
/home/ubuntu/go/src/github.com/nytlabs/gojee/jee.go:1000 +0x2f1a
[fp=0x7f2d386f2fb0] github.com/nytlabs/streamtools/blocks.Filter(0xc2003e1a80)
/home/ubuntu/go/src/github.com/nytlabs/streamtools/blocks/filter.go:24 +0xdc
[fp=0x7f2d386f2fb8] runtime.goexit()
/usr/lib/go/src/pkg/runtime/proc.c:1223
created by github.com/nytlabs/streamtools/daemon.(*Daemon).CreateBlock
/home/ubuntu/go/src/github.com/nytlabs/streamtools/daemon/daemon.go:438 +0x310
Must use
.['random_float']
instead of
.random_float
which seems like a bummer.
Maybe something like:
$stringify({x: 5, y: 6})
$parse( '{"x":5,"y":6}')
time w/ format
if we are in eval and
immediately return nil without calling getkeyvalues because we wont return anything else.
join array of strings. useful for get URL arrays
rewrite lexer so that it works like this: http://golang.org/src/pkg/text/template/parse/
similar to jq's
@uri, @json, @html, etc
ability to $str( float64 )
panic: interface conversion: interface is nil, not map[string]interface {}
goroutine 255055 [running]:
runtime.panic(0x94f020, 0xc210a1e7c0)
/usr/local/go/src/pkg/runtime/panic.c:266 +0xb6
github.com/nytlabs/gojee.func·043(0x0, 0x0, 0x865de0, 0xc210c48e50, 0xc210052248, ...)
/home/ubuntu/go/src/github.com/nytlabs/gojee/jee.go:788 +0xb2
github.com/nytlabs/gojee.Eval(0xc2109b6900, 0x863380, 0xc210438900, 0x864700, 0x0, ...)
/home/ubuntu/go/src/github.com/nytlabs/gojee/jee.go:1107 +0x2ad2
github.com/nytlabs/gojee.Eval(0xc2109b6880, 0x863380, 0xc210438900, 0x864700, 0x1, ...)
/home/ubuntu/go/src/github.com/nytlabs/gojee/jee.go:983 +0x83f
github.com/nytlabs/gojee.Eval(0xc2109b6600, 0x863380, 0xc210438900, 0xc2103cd701, 0x1, ...)
/home/ubuntu/go/src/github.com/nytlabs/gojee/jee.go:1112 +0x2d24
github.com/nytlabs/streamtools/st/library.(*Filter).Run(0xc2105f25b0)
/home/ubuntu/go/src/github.com/nytlabs/streamtools/st/library/filter.go:46 +0x151
created by github.com/nytlabs/streamtools/st/blocks.BlockRoutine
/home/ubuntu/go/src/github.com/nytlabs/streamtools/st/blocks/blocks.go:244 +0xfb
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.