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

Function protoStruct

common/ast/conversion.go:493–511  ·  view source on GitHub ↗
(id int64, s StructExpr)

Source from the content-addressed store, hash-verified

491}
492
493func protoStruct(id int64, s StructExpr) (*exprpb.Expr, error) {
494 entries := make([]*exprpb.Expr_CreateStruct_Entry, len(s.Fields()))
495 var err error
496 for i, e := range s.Fields() {
497 entries[i], err = EntryExprToProto(e)
498 if err != nil {
499 return nil, err
500 }
501 }
502 return &exprpb.Expr{
503 Id: id,
504 ExprKind: &exprpb.Expr_StructExpr{
505 StructExpr: &exprpb.Expr_CreateStruct{
506 MessageName: s.TypeName(),
507 Entries: entries,
508 },
509 },
510 }, nil
511}
512
513func protoStructField(id int64, f StructField) (*exprpb.Expr_CreateStruct_Entry, error) {
514 v, err := ExprToProto(f.Value())

Callers 1

ExprToProtoFunction · 0.85

Calls 3

EntryExprToProtoFunction · 0.85
FieldsMethod · 0.65
TypeNameMethod · 0.65

Tested by

no test coverage detected