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

Function ExistsOneMacroExpander

cel/macro.go:246–256  ·  view source on GitHub ↗

ExistsOneMacroExpander expands the input call arguments into a comprehension that returns true if exactly one of the elements in the range match the predicate expressions: .exists_one( , )

(meh MacroExprHelper, target *exprpb.Expr, args []*exprpb.Expr)

Source from the content-addressed store, hash-verified

244// one of the elements in the range match the predicate expressions:
245// <iterRange>.exists_one(<iterVar>, <predicate>)
246func ExistsOneMacroExpander(meh MacroExprHelper, target *exprpb.Expr, args []*exprpb.Expr) (*exprpb.Expr, *Error) {
247 ph, err := toParserHelper(meh)
248 if err != nil {
249 return nil, err
250 }
251 out, err := parser.MakeExistsOne(ph, mustAdaptToExpr(target), mustAdaptToExprs(args))
252 if err != nil {
253 return nil, err
254 }
255 return adaptToProto(out)
256}
257
258// MapMacroExpander expands the input call arguments into a comprehension that transforms each element in the
259// input to produce an output list.

Callers 1

TestMacroInteropFunction · 0.85

Calls 5

MakeExistsOneFunction · 0.92
toParserHelperFunction · 0.85
mustAdaptToExprFunction · 0.85
mustAdaptToExprsFunction · 0.85
adaptToProtoFunction · 0.85

Tested by 1

TestMacroInteropFunction · 0.68