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

Function MapMacroExpander

cel/macro.go:268–278  ·  view source on GitHub ↗

MapMacroExpander expands the input call arguments into a comprehension that transforms each element in the input to produce an output list. There are two call patterns supported by map: .map( , ) .map( , , ) In the second fo

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

Source from the content-addressed store, hash-verified

266// In the second form only iterVar values which return true when provided to the predicate expression
267// are transformed.
268func MapMacroExpander(meh MacroExprHelper, target *exprpb.Expr, args []*exprpb.Expr) (*exprpb.Expr, *Error) {
269 ph, err := toParserHelper(meh)
270 if err != nil {
271 return nil, err
272 }
273 out, err := parser.MakeMap(ph, mustAdaptToExpr(target), mustAdaptToExprs(args))
274 if err != nil {
275 return nil, err
276 }
277 return adaptToProto(out)
278}
279
280// FilterMacroExpander expands the input call arguments into a comprehension which produces a list which contains
281// only elements which match the provided predicate expression:

Callers 1

TestMacroInteropFunction · 0.85

Calls 5

MakeMapFunction · 0.92
toParserHelperFunction · 0.85
mustAdaptToExprFunction · 0.85
mustAdaptToExprsFunction · 0.85
adaptToProtoFunction · 0.85

Tested by 1

TestMacroInteropFunction · 0.68