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

Method HasTagPrefix

expr/attribute.go:524–540  ·  view source on GitHub ↗

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

(prefix string)

Source from the content-addressed store, hash-verified

522// HasTagPrefix returns true if the attribute is an object that has an attribute with
523// the given tag prefix.
524func (a *AttributeExpr) HasTagPrefix(prefix string) bool {
525 if a == nil {
526 return false
527 }
528 obj := AsObject(a.Type)
529 if obj == nil {
530 return false
531 }
532 for _, at := range *obj {
533 for k := range at.Attribute.Meta {
534 if strings.HasPrefix(k, prefix) {
535 return true
536 }
537 }
538 }
539 return false
540}
541
542// FieldTag returns the field tag if the attribute is a field.
543func (a *AttributeExpr) FieldTag() (tag string, found bool) {

Callers 2

hasTagPrefixFunction · 0.80

Calls 1

AsObjectFunction · 0.85

Tested by 1