EntryExprToProto converts an ast.EntryExpr to a protobuf CreateStruct entry
(e EntryExpr)
| 313 | |
| 314 | // EntryExprToProto converts an ast.EntryExpr to a protobuf CreateStruct entry |
| 315 | func EntryExprToProto(e EntryExpr) (*exprpb.Expr_CreateStruct_Entry, error) { |
| 316 | switch e.Kind() { |
| 317 | case MapEntryKind: |
| 318 | return protoMapEntry(e.ID(), e.AsMapEntry()) |
| 319 | case StructFieldKind: |
| 320 | return protoStructField(e.ID(), e.AsStructField()) |
| 321 | case UnspecifiedEntryExprKind: |
| 322 | return &exprpb.Expr_CreateStruct_Entry{}, nil |
| 323 | } |
| 324 | return nil, fmt.Errorf("unsupported expr entry kind: %v", e) |
| 325 | } |
| 326 | |
| 327 | func protoCall(id int64, call CallExpr) (*exprpb.Expr, error) { |
| 328 | var err error |