(expr string)
| 35 | } |
| 36 | |
| 37 | func NewScriptMatch(expr string) (*ScriptMatch, error) { |
| 38 | script := tengo.NewScript(fmt.Appendf(nil, "__res__ := (%s)", expr)) |
| 39 | if err := script.Add("c", &clientObject{}); err != nil { |
| 40 | return nil, err |
| 41 | } |
| 42 | compiled, err := script.Compile() |
| 43 | if err != nil { |
| 44 | return nil, err |
| 45 | } |
| 46 | return &ScriptMatch{compiled}, nil |
| 47 | } |
| 48 | |
| 49 | // use result of eval script expression for match. |
| 50 | // expression examples: |