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

Method MaybeAttribute

interpreter/attribute_patterns.go:210–229  ·  view source on GitHub ↗

MaybeAttribute implementation of the AttributeFactory interface which ensure that the set of 'maybe' NamespacedAttribute values are produced using the partialAttributeFactory rather than the base AttributeFactory implementation.

(id int64, name string)

Source from the content-addressed store, hash-verified

208// 'maybe' NamespacedAttribute values are produced using the partialAttributeFactory rather than
209// the base AttributeFactory implementation.
210func (fac *partialAttributeFactory) MaybeAttribute(id int64, name string) Attribute {
211 var names []string
212 // When there's a single name with a dot prefix, it indicates that the 'maybe' attribute is a
213 // globally namespaced identifier.
214 if strings.HasPrefix(name, ".") {
215 names = append(names, name)
216 } else {
217 // In all other cases, the candidate names should be inferred.
218 names = fac.container.ResolveCandidateNames(name)
219 }
220 return &maybeAttribute{
221 id: id,
222 attrs: []NamespacedAttribute{
223 fac.AbsoluteAttribute(id, names...),
224 },
225 adapter: fac.adapter,
226 provider: fac.provider,
227 fac: fac,
228 }
229}
230
231// matchesUnknownPatterns returns true if the variable names and qualifiers for a given
232// Attribute value match any of the ActivationPattern objects in the set of unknown activation

Callers

nothing calls this directly

Calls 2

AbsoluteAttributeMethod · 0.95
ResolveCandidateNamesMethod · 0.80

Tested by

no test coverage detected