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

Function FunctionBinding

common/decls/decls.go:949–960  ·  view source on GitHub ↗

FunctionBinding provides the implementation of a variadic overload. The provided function is protected by a runtime type-guard which ensures runtime type agreement between the overload signature and runtime argument types.

(binding functions.FunctionOp)

Source from the content-addressed store, hash-verified

947// FunctionBinding provides the implementation of a variadic overload. The provided function is protected by a runtime
948// type-guard which ensures runtime type agreement between the overload signature and runtime argument types.
949func FunctionBinding(binding functions.FunctionOp) OverloadOpt {
950 return func(o *OverloadDecl) (*OverloadDecl, error) {
951 if o.HasBinding() {
952 return nil, fmt.Errorf("overload already has a binding: %s", o.ID())
953 }
954 if o.hasLateBinding {
955 return nil, fmt.Errorf("overload already has a late binding: %s", o.ID())
956 }
957 o.functionOp = binding
958 return o, nil
959 }
960}
961
962// AsyncBinding provides the implementation of an asynchronous overload. The provided function
963// is called in its own goroutine with the provided context. The function should block until

Calls 2

HasBindingMethod · 0.80
IDMethod · 0.65