MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / Eval

Function Eval

pkg/filter/ql/ast.go:34–46  ·  view source on GitHub ↗

Eval evaluates expr against a map that contains the field values.

(expr Expr, m map[string]interface{}, useFuncValuer bool)

Source from the content-addressed store, hash-verified

32
33// Eval evaluates expr against a map that contains the field values.
34func Eval(expr Expr, m map[string]interface{}, useFuncValuer bool) bool {
35 var eval ValuerEval
36 if useFuncValuer {
37 eval = ValuerEval{Valuer: MultiValuer(MapValuer(m), FunctionValuer{m})}
38 } else {
39 eval = ValuerEval{Valuer: MapValuer(m)}
40 }
41 v, ok := eval.Eval(expr).(bool)
42 if !ok {
43 return false
44 }
45 return v
46}
47
48// MapValuer is a valuer that substitutes values for the mapped interface.
49type MapValuer map[string]interface{}

Callers 4

RunMethod · 0.92
evalBoundSequenceMethod · 0.92
evalSequenceMethod · 0.92
RunSequenceMethod · 0.92

Calls 3

EvalMethod · 0.95
MultiValuerFunction · 0.85
MapValuerTypeAlias · 0.85

Tested by

no test coverage detected