()
| 48 | } |
| 49 | |
| 50 | func 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 | |
| 73 | func ExampleEval_bytes_literal() { |
| 74 | // Bytes literal returns []byte. |