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

Function EvalStateObserver

interpreter/interpreter.go:98–110  ·  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

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

Callers 8

newProgramFunction · 0.92
TestPruneFunction · 0.85
TestInterpreterFunction · 0.85
runOptionsBenchmarkFunction · 0.85

Calls 1

NewMethod · 0.80