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

Function getProtoExt

ext/protos.go:118–127  ·  view source on GitHub ↗

getProtoExt generates a 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

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) {
119 if !macroTargetMatchesNamespace(protoNamespace, target) {
120 return nil, nil
121 }
122 extFieldName, err := getExtFieldName(mef, args[1])
123 if err != nil {
124 return nil, err
125 }
126 return mef.NewSelect(args[0], extFieldName), nil
127}
128
129func getExtFieldName(mef cel.MacroExprFactory, expr ast.Expr) (string, *cel.Error) {
130 isValid := false

Callers

nothing calls this directly

Calls 3

getExtFieldNameFunction · 0.85
NewSelectMethod · 0.65

Tested by

no test coverage detected