v1.15.0
Expr is a Go-centric expression language designed to deliver dynamic configurations with unparalleled accuracy, safety, and speed.
In this release:
- Added support for variables.
let foo = filter(tweets, .Text contains "foo"); let name = foo?.Author?.Name ?? "unknown"; upper(name)
- Added configuration to enable/disable builtin functions.
- Added a bunch of optimizations for builtin function combinations:
len(filter())
andmap(filter())
filter()[0]
andfilter()[-1]
- Added a bunch of new builtin functions:
sort
,sortBy
groupBy
toPairs
,fromPairs
take
,reduce
,mean
,median
.
- Fixed in-range optimization to be only applied to integers.
- Fixed float folding optimization.
- Fixed duration*integer mutliplications.
- Improved language and developer documentation.
Examples:
tweets | filter(.Size < 280) | map(.Content) | join(" -- ")
filter(posts, {
let span = now() - .CreatedAt;
let limit = 7 * duration("24h");
span >= limit
})