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

Interface AttributeFactory

interpreter/attributes.go:28–63  ·  view source on GitHub ↗

AttributeFactory provides methods creating Attribute and Qualifier values.

Source from the content-addressed store, hash-verified

26
27// AttributeFactory provides methods creating Attribute and Qualifier values.
28type AttributeFactory interface {
29 // AbsoluteAttribute creates an attribute that refers to a top-level variable name.
30 //
31 // Checked expressions generate absolute attribute with a single name.
32 // Parse-only expressions may have more than one possible absolute identifier when the
33 // expression is created within a container, e.g. package or namespace.
34 //
35 // When there is more than one name supplied to the AbsoluteAttribute call, the names
36 // must be in CEL's namespace resolution order. The name arguments provided here are
37 // returned in the same order as they were provided by the NamespacedAttribute
38 // CandidateVariableNames method.
39 AbsoluteAttribute(id int64, names ...string) NamespacedAttribute
40
41 // ConditionalAttribute creates an attribute with two Attribute branches, where the Attribute
42 // that is resolved depends on the boolean evaluation of the input 'expr'.
43 ConditionalAttribute(id int64, expr Interpretable, t, f Attribute) Attribute
44
45 // MaybeAttribute creates an attribute that refers to either a field selection or a namespaced
46 // variable name.
47 //
48 // Only expressions which have not been type-checked may generate oneof attributes.
49 MaybeAttribute(id int64, name string) Attribute
50
51 // RelativeAttribute creates an attribute whose value is a qualification of a dynamic
52 // computation rather than a static variable reference.
53 RelativeAttribute(id int64, operand Interpretable) Attribute
54
55 // NewQualifier creates a qualifier on the target object with a given value.
56 //
57 // The 'val' may be an Attribute or any proto-supported map key type: bool, int, string, uint.
58 //
59 // The qualifier may consider the object type being qualified, if present. If absent, the
60 // qualification should be considered dynamic and the qualification should still work, though
61 // it may be sub-optimal.
62 NewQualifier(objType *types.Type, qualID int64, val any, opt bool) (Qualifier, error)
63}
64
65// Qualifier marker interface for designating different qualifier values and where they appear
66// within field selections and index call expressions (`_[_]`).

Implementers 1

attrFactoryinterpreter/attributes.go

Calls

no outgoing calls

Tested by

no test coverage detected