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

Function Function

cel/decls.go:195–203  ·  view source on GitHub ↗

Function defines a function and overloads with optional singleton or per-overload bindings. Using Function is roughly equivalent to calling Declarations() to declare the function signatures and Functions() to define the function bindings, if they have been defined. Specifying the same function name

(name string, opts ...FunctionOpt)

Source from the content-addressed store, hash-verified

193// function which is capable of inspecting the contents of the type and resolving the appropriate
194// overload as CEL can only make inferences by type-name regarding such types.
195func Function(name string, opts ...FunctionOpt) EnvOption {
196 return func(e *Env) (*Env, error) {
197 fn, err := decls.NewFunction(name, opts...)
198 if err != nil {
199 return nil, err
200 }
201 return FunctionDecls(fn)(e)
202 }
203}
204
205// OverloadSelector selects an overload associated with a given function when it returns true.
206//

Callers 15

locationCodeEnvOptionFunction · 0.92
fnEnvOptionFunction · 0.92
helper_test.goFile · 0.92
locationCodeEnvOptionFunction · 0.92
CompileOptionsMethod · 0.92
CompileOptionsMethod · 0.92
CompileOptionsMethod · 0.92
CompileOptionsMethod · 0.92
CompileOptionsMethod · 0.92
CompileOptionsMethod · 0.92
TestProtosNonMatchFunction · 0.92
CompileOptionsMethod · 0.92

Calls 2

NewFunctionFunction · 0.92
FunctionDeclsFunction · 0.85

Tested by 15

locationCodeEnvOptionFunction · 0.74
fnEnvOptionFunction · 0.74
TestProtosNonMatchFunction · 0.74
TestMathNonMatchFunction · 0.74
TestInliningOptimizerFunction · 0.74
ExampleFunction · 0.74
Example_globalOverloadFunction · 0.74
Example_statefulOverloadFunction · 0.74
CompileOptionsMethod · 0.74
Example_cel_OverloadFunction · 0.74
locationCodeEnvOptionFunction · 0.74
TestFunctionMergeFunction · 0.56