Skip to content

Commit 997fbb2

Browse files
authored
Re-export interpreter.AttributePattern in package cel. (#1158)
The cel.AttributePattern name is taken by a helper function. A different name is thus picked to avoid breaking existing consumers of package cel.
1 parent a6fbac9 commit 997fbb2

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

cel/program.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func NewActivation(bindings any) (Activation, error) {
7575
return interpreter.NewActivation(bindings)
7676
}
7777

78-
// PartialActivation extends the Activation interface with a set of UnknownAttributePatterns.
78+
// PartialActivation extends the Activation interface with a set of unknown AttributePatterns.
7979
type PartialActivation = interpreter.PartialActivation
8080

8181
// NoVars returns an empty Activation.
@@ -91,7 +91,7 @@ func NoVars() Activation {
9191
//
9292
// The `vars` value may either be an Activation or any valid input to the NewActivation call.
9393
func PartialVars(vars any,
94-
unknowns ...*interpreter.AttributePattern) (PartialActivation, error) {
94+
unknowns ...*AttributePatternType) (PartialActivation, error) {
9595
return interpreter.NewPartialActivation(vars, unknowns...)
9696
}
9797

@@ -108,12 +108,15 @@ func PartialVars(vars any,
108108
// fully qualified variable name may be `ns.app.a`, `ns.a`, or `a` per the CEL namespace resolution
109109
// rules. Pick the fully qualified variable name that makes sense within the container as the
110110
// AttributePattern `varName` argument.
111+
func AttributePattern(varName string) *AttributePatternType {
112+
return interpreter.NewAttributePattern(varName)
113+
}
114+
115+
// AttributePatternType represents a top-level variable with an optional set of qualifier patterns.
111116
//
112117
// See the interpreter.AttributePattern and interpreter.AttributeQualifierPattern for more info
113118
// about how to create and manipulate AttributePattern values.
114-
func AttributePattern(varName string) *interpreter.AttributePattern {
115-
return interpreter.NewAttributePattern(varName)
116-
}
119+
type AttributePatternType = interpreter.AttributePattern
117120

118121
// EvalDetails holds additional information observed during the Eval() call.
119122
type EvalDetails struct {

0 commit comments

Comments
 (0)