MCPcopy Create free account
hub / github.com/cel-expr/cel-go / EvalStateObserver

Function EvalStateObserver

interpreter/interpreter.go:94–107  ·  view source on GitHub ↗

EvalStateObserver provides an observer which records the value associated with the given expression id. EvalState must be provided to the observer.

(opts ...evalStateOption)

Source from the content-addressed store, hash-verified

92// EvalStateObserver provides an observer which records the value associated with the given expression id.
93// EvalState must be provided to the observer.
94func EvalStateObserver(opts ...evalStateOption) PlannerOption {
95 et := &evalStateFactory{factory: NewEvalState}
96 for _, o := range opts {
97 et = o(et)
98 }
99 return func(p *planner) (*planner, error) {
100 if et.factory == nil {
101 return nil, errors.New("eval state factory not configured")
102 }
103 p.observers = append(p.observers, et)
104 p.decorators = append(p.decorators, decObserveEval(et.Observe))
105 return p, nil
106 }
107}
108
109// activationWrapper identifies an object carrying local variables which should not be exposed to the user
110// Activations used for such purposes can be unwrapped to return the activation which omits local state.

Callers 6

newProgramFunction · 0.92
TestPruneFunction · 0.85
TestInterpreterFunction · 0.85

Calls 2

decObserveEvalFunction · 0.85
NewMethod · 0.80

Tested by 5

TestPruneFunction · 0.68
TestInterpreterFunction · 0.68