HasTagPrefix returns true if the attribute is an object that has an attribute with the given tag prefix.
(prefix string)
| 522 | // HasTagPrefix returns true if the attribute is an object that has an attribute with |
| 523 | // the given tag prefix. |
| 524 | func (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. |
| 543 | func (a *AttributeExpr) FieldTag() (tag string, found bool) { |