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

Function AsyncBinding

common/decls/decls.go:968–979  ·  view source on GitHub ↗

AsyncBinding provides the implementation of an asynchronous overload. The provided function is called in its own goroutine with the provided context. The function should block until the result is available, and the framework manages goroutine and channel lifecycle. This follows the same pattern use

(fn functions.BlockingAsyncOp)

Source from the content-addressed store, hash-verified

966// This follows the same pattern used by gRPC-Go and other major Go frameworks where user
967// code is synchronous and the framework manages concurrency.
968func AsyncBinding(fn functions.BlockingAsyncOp) OverloadOpt {
969 return func(o *OverloadDecl) (*OverloadDecl, error) {
970 if o.HasBinding() {
971 return nil, fmt.Errorf("overload already has a binding: %s", o.ID())
972 }
973 if o.hasLateBinding {
974 return nil, fmt.Errorf("overload already has a late binding: %s", o.ID())
975 }
976 o.asyncOp = wrapAsyncOp(fn)
977 return o, nil
978 }
979}
980
981// wrapAsyncOp adapts a blocking function into the channel-based AsyncOp used internally.
982//

Callers 7

AsyncBindingFunction · 0.92
TimeoutBindingFunction · 0.92
RetryBindingFunction · 0.92
TestAsyncBindingFunction · 0.70

Calls 3

wrapAsyncOpFunction · 0.85
HasBindingMethod · 0.80
IDMethod · 0.65

Tested by 4

TestAsyncBindingFunction · 0.56