MCPcopy
hub / github.com/expr-lang/expr / ExampleCompile

Function ExampleCompile

expr_test.go:50–71  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

48}
49
50func ExampleCompile() {
51 env := map[string]any{
52 "foo": 1,
53 "bar": 99,
54 }
55
56 program, err := expr.Compile("foo in 1..99 and bar in 1..99", expr.Env(env))
57 if err != nil {
58 fmt.Printf("%v", err)
59 return
60 }
61
62 output, err := expr.Run(program, env)
63 if err != nil {
64 fmt.Printf("%v", err)
65 return
66 }
67
68 fmt.Printf("%v", output)
69
70 // Output: true
71}
72
73func ExampleEval_bytes_literal() {
74 // Bytes literal returns []byte.

Callers

nothing calls this directly

Calls 4

CompileFunction · 0.92
EnvStruct · 0.92
RunFunction · 0.92
PrintfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…