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

Function hasProtoExt

ext/protos.go:106–115  ·  view source on GitHub ↗

hasProtoExt generates a test-only select expression for a fully-qualified extension name on a protobuf message.

(mef cel.MacroExprFactory, target ast.Expr, args []ast.Expr)

Source from the content-addressed store, hash-verified

104
105// hasProtoExt generates a test-only select expression for a fully-qualified extension name on a protobuf message.
106func hasProtoExt(mef cel.MacroExprFactory, target ast.Expr, args []ast.Expr) (ast.Expr, *cel.Error) {
107 if !macroTargetMatchesNamespace(protoNamespace, target) {
108 return nil, nil
109 }
110 extensionField, err := getExtFieldName(mef, args[1])
111 if err != nil {
112 return nil, err
113 }
114 return mef.NewPresenceTest(args[0], extensionField), nil
115}
116
117// getProtoExt generates a select expression for a fully-qualified extension name on a protobuf message.
118func getProtoExt(mef cel.MacroExprFactory, target ast.Expr, args []ast.Expr) (ast.Expr, *cel.Error) {

Callers

nothing calls this directly

Calls 3

getExtFieldNameFunction · 0.85
NewPresenceTestMethod · 0.65

Tested by

no test coverage detected