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

Method NewObject

cel/macro.go:440–446  ·  view source on GitHub ↗

NewObject creates a CreateStruct instruction for an object with a given type name and optional set of field initializers.

(typeName string, fieldInits ...*exprpb.Expr_CreateStruct_Entry)

Source from the content-addressed store, hash-verified

438// NewObject creates a CreateStruct instruction for an object with a given type name and
439// optional set of field initializers.
440func (ah *adaptingHelper) NewObject(typeName string, fieldInits ...*exprpb.Expr_CreateStruct_Entry) *exprpb.Expr {
441 adaptedEntries := make([]ast.EntryExpr, len(fieldInits))
442 for i, e := range fieldInits {
443 adaptedEntries[i] = mustAdaptToEntryExpr(e)
444 }
445 return mustAdaptToProto(ah.modernHelper.NewStruct(typeName, adaptedEntries...))
446}
447
448// NewObjectFieldInit creates a new Object field initializer from the field name and value.
449func (ah *adaptingHelper) NewObjectFieldInit(field string, init *exprpb.Expr, optional bool) *exprpb.Expr_CreateStruct_Entry {

Callers

nothing calls this directly

Calls 3

mustAdaptToEntryExprFunction · 0.85
mustAdaptToProtoFunction · 0.85
NewStructMethod · 0.65

Tested by

no test coverage detected