Expr Versions Save

Expression language and expression evaluation for Go

v1.15.6

5 months ago
  • New module path expr-lang/epxr ⚠️
  • Added expr.WithContext() option to pass context to custom functions.
  • Added ast package comments.
  • Hidden internal fields in vm.Program.

v1.15.5

6 months ago
  • Added ceil(), floor() and round() function.
  • Fixed type checker for float arguments.

v1.15.4

6 months ago
  • Improved type checking for $env
  • Added support for floats in sort() built-in
  • Fixed: AST printing for ?? operator
  • Fixed: only emit OpEqual{Int,String} for simple types
  • Fixed: fetch without OpDeref (#467)
  • Docs: categorize Language Definition functions (#452)
  • Changed: ast.Node type now is not copied with ast.Patch

v1.15.3

8 months ago
  • Added type checks to detect 42 in ["a"] as invalid.

v1.15.2

8 months ago
  • Propagate uint32 func argument types in AST (#438)

v1.15.1

8 months ago
  • Fixed type checker for the in operator.
  • Fixed memory budget calculations for ranges.

v1.15.0

9 months ago

Expr is a Go-centric expression language designed to deliver dynamic configurations with unparalleled accuracy, safety, and speed.

expr repl demo

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()) and map(filter())
    • filter()[0] and filter()[-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
})

v1.14.3

9 months ago
  • Fixed builtin type checks for any

v1.14.2

9 months ago
  • Fixed slice node String() with omitted from or to fields.

v1.14.1

9 months ago
  • Added ast.String() to nodes.
  • Added keys(), values() and type() builtins.
  • Added the ability to disable builtins via expr.DisableBuiltin().
  • Fixed bunch of errors with corner cases in type checkers.