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

Function EntryExprToProto

common/ast/conversion.go:315–325  ·  view source on GitHub ↗

EntryExprToProto converts an ast.EntryExpr to a protobuf CreateStruct entry

(e EntryExpr)

Source from the content-addressed store, hash-verified

313
314// EntryExprToProto converts an ast.EntryExpr to a protobuf CreateStruct entry
315func 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
327func protoCall(id int64, call CallExpr) (*exprpb.Expr, error) {
328 var err error

Callers 4

mustAdaptToProtoEntryFunction · 0.92
protoMapFunction · 0.85
protoStructFunction · 0.85

Calls 6

protoMapEntryFunction · 0.85
protoStructFieldFunction · 0.85
KindMethod · 0.65
IDMethod · 0.65
AsMapEntryMethod · 0.65
AsStructFieldMethod · 0.65

Tested by 1