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

Function attrQualifyIfPresent

interpreter/attributes.go:1353–1364  ·  view source on GitHub ↗

attrQualifyIfPresent conditionally performs the qualification of the result of attribute is present on the target object.

(fac AttributeFactory, vars Activation, obj any, qualAttr Attribute,
	presenceOnly bool)

Source from the content-addressed store, hash-verified

1351// attrQualifyIfPresent conditionally performs the qualification of the result of attribute is present
1352// on the target object.
1353func attrQualifyIfPresent(fac AttributeFactory, vars Activation, obj any, qualAttr Attribute,
1354 presenceOnly bool) (any, bool, error) {
1355 val, err := qualAttr.Resolve(vars)
1356 if err != nil {
1357 return nil, false, err
1358 }
1359 qual, err := fac.NewQualifier(nil, qualAttr.ID(), val, qualAttr.IsOptional())
1360 if err != nil {
1361 return nil, false, err
1362 }
1363 return qual.QualifyIfPresent(vars, obj, presenceOnly)
1364}
1365
1366// refQualify attempts to convert the value to a CEL value and then uses reflection methods to try and
1367// apply the qualifier with the option to presence test field accesses before retrieving field values.

Callers 5

QualifyIfPresentMethod · 0.85
QualifyIfPresentMethod · 0.85
QualifyIfPresentMethod · 0.85
QualifyIfPresentMethod · 0.85
QualifyIfPresentMethod · 0.85

Calls 5

QualifyIfPresentMethod · 0.95
ResolveMethod · 0.65
NewQualifierMethod · 0.65
IDMethod · 0.65
IsOptionalMethod · 0.65

Tested by

no test coverage detected