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)
| 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. |
| 195 | func 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 | // |