MCPcopy Create free account
hub / github.com/goadesign/goa / HasTag

Method HasTag

expr/attribute.go:506–520  ·  view source on GitHub ↗

HasTag returns true if the attribute is an object that has an attribute with the given tag.

(tag string)

Source from the content-addressed store, hash-verified

504// HasTag returns true if the attribute is an object that has an attribute with
505// the given tag.
506func (a *AttributeExpr) HasTag(tag string) bool {
507 if a == nil {
508 return false
509 }
510 obj := AsObject(a.Type)
511 if obj == nil {
512 return false
513 }
514 for _, at := range *obj {
515 if _, ok := at.Attribute.Meta[tag]; ok {
516 return true
517 }
518 }
519 return false
520}
521
522// HasTagPrefix returns true if the attribute is an object that has an attribute with
523// the given tag prefix.

Callers 2

hasTagFunction · 0.80
TestAttributeExprHasTagFunction · 0.80

Calls 1

AsObjectFunction · 0.85

Tested by 1

TestAttributeExprHasTagFunction · 0.64