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

Method AbsoluteAttribute

interpreter/attributes.go:173–203  ·  view source on GitHub ↗

AbsoluteAttribute refers to a variable value and an optional qualifier path. The namespaceNames represent the names the variable could have based on namespace resolution rules.

(id int64, names ...string)

Source from the content-addressed store, hash-verified

171// The namespaceNames represent the names the variable could have based on namespace
172// resolution rules.
173func (r *attrFactory) AbsoluteAttribute(id int64, names ...string) NamespacedAttribute {
174 disambiguateNames := false
175 for idx, name := range names {
176 if strings.HasPrefix(name, ".") {
177 disambiguateNames = true
178 names[idx] = strings.TrimPrefix(name, ".")
179 }
180 }
181 if len(names) == 1 && !disambiguateNames {
182 return &identAttribute{
183 id: id,
184 name: names[0],
185 candidateNames: names,
186 qualifiers: []Qualifier{},
187 adapter: r.adapter,
188 provider: r.provider,
189 fac: r,
190 errorOnBadPresenceTest: r.errorOnBadPresenceTest,
191 }
192 }
193 return &absoluteAttribute{
194 id: id,
195 namespaceNames: names,
196 disambiguateNames: disambiguateNames,
197 qualifiers: []Qualifier{},
198 adapter: r.adapter,
199 provider: r.provider,
200 fac: r,
201 errorOnBadPresenceTest: r.errorOnBadPresenceTest,
202 }
203}
204
205// ConditionalAttribute supports the case where an attribute selection may occur on a conditional
206// expression, e.g. (cond ? a : b).c

Callers 1

MaybeAttributeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected