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

Function protoMap

common/ast/conversion.go:438–455  ·  view source on GitHub ↗
(id int64, m MapExpr)

Source from the content-addressed store, hash-verified

436}
437
438func protoMap(id int64, m MapExpr) (*exprpb.Expr, error) {
439 entries := make([]*exprpb.Expr_CreateStruct_Entry, len(m.Entries()))
440 var err error
441 for i, e := range m.Entries() {
442 entries[i], err = EntryExprToProto(e)
443 if err != nil {
444 return nil, err
445 }
446 }
447 return &exprpb.Expr{
448 Id: id,
449 ExprKind: &exprpb.Expr_StructExpr{
450 StructExpr: &exprpb.Expr_CreateStruct{
451 Entries: entries,
452 },
453 },
454 }, nil
455}
456
457func protoMapEntry(id int64, e MapEntry) (*exprpb.Expr_CreateStruct_Entry, error) {
458 k, err := ExprToProto(e.Key())

Callers 1

ExprToProtoFunction · 0.70

Calls 2

EntryExprToProtoFunction · 0.85
EntriesMethod · 0.65

Tested by

no test coverage detected