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

Function protoList

common/ast/conversion.go:405–423  ·  view source on GitHub ↗
(id int64, list ListExpr)

Source from the content-addressed store, hash-verified

403}
404
405func protoList(id int64, list ListExpr) (*exprpb.Expr, error) {
406 var err error
407 elems := make([]*exprpb.Expr, list.Size())
408 for i, e := range list.Elements() {
409 elems[i], err = ExprToProto(e)
410 if err != nil {
411 return nil, err
412 }
413 }
414 return &exprpb.Expr{
415 Id: id,
416 ExprKind: &exprpb.Expr_ListExpr{
417 ListExpr: &exprpb.Expr_CreateList{
418 Elements: elems,
419 OptionalIndices: list.OptionalIndices(),
420 },
421 },
422 }, nil
423}
424
425func protoLiteral(id int64, val ref.Val) (*exprpb.Expr, error) {
426 c, err := ValToConstant(val)

Callers 1

ExprToProtoFunction · 0.85

Calls 4

ExprToProtoFunction · 0.85
SizeMethod · 0.65
ElementsMethod · 0.65
OptionalIndicesMethod · 0.65

Tested by

no test coverage detected