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

Function ExistsMacroExpander

cel/macro.go:231–241  ·  view source on GitHub ↗

ExistsMacroExpander expands the input call arguments into a comprehension that returns true if any of the elements in the range match the predicate expressions: .exists( , )

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

Source from the content-addressed store, hash-verified

229// elements in the range match the predicate expressions:
230// <iterRange>.exists(<iterVar>, <predicate>)
231func ExistsMacroExpander(meh MacroExprHelper, target *exprpb.Expr, args []*exprpb.Expr) (*exprpb.Expr, *Error) {
232 ph, err := toParserHelper(meh)
233 if err != nil {
234 return nil, err
235 }
236 out, err := parser.MakeExists(ph, mustAdaptToExpr(target), mustAdaptToExprs(args))
237 if err != nil {
238 return nil, err
239 }
240 return adaptToProto(out)
241}
242
243// ExistsOneMacroExpander expands the input call arguments into a comprehension that returns true if exactly
244// one of the elements in the range match the predicate expressions:

Callers 1

TestCustomExistsMacroFunction · 0.85

Calls 5

MakeExistsFunction · 0.92
toParserHelperFunction · 0.85
mustAdaptToExprFunction · 0.85
mustAdaptToExprsFunction · 0.85
adaptToProtoFunction · 0.85

Tested by 1

TestCustomExistsMacroFunction · 0.68