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

Function FunctionDecls

cel/decls.go:221–235  ·  view source on GitHub ↗

FunctionDecls provides one or more fully formed function declarations to be added to the environment.

(funcs ...*decls.FunctionDecl)

Source from the content-addressed store, hash-verified

219
220// FunctionDecls provides one or more fully formed function declarations to be added to the environment.
221func FunctionDecls(funcs ...*decls.FunctionDecl) EnvOption {
222 return func(e *Env) (*Env, error) {
223 var err error
224 for _, fn := range funcs {
225 if existing, found := e.functions[fn.Name()]; found {
226 fn, err = existing.Merge(fn)
227 if err != nil {
228 return nil, err
229 }
230 }
231 e.functions[fn.Name()] = fn
232 }
233 return e, nil
234 }
235}
236
237// FunctionOpt defines a functional option for configuring a function declaration.
238type FunctionOpt = decls.FunctionOpt

Callers 4

configToEnvOptionsFunction · 0.85
FunctionFunction · 0.85

Calls 2

MergeMethod · 0.80
NameMethod · 0.65

Tested by 2