WalkMappedAttr iterates over the mapped attributes. It calls the given function giving each attribute as it iterates. WalkMappedAttr stops if there is no more attribute to iterate over or if the iterator function returns an error in which case it returns the error.
(ma *MappedAttributeExpr, it MappedAttributeWalker)
| 101 | // is no more attribute to iterate over or if the iterator function returns an |
| 102 | // error in which case it returns the error. |
| 103 | func WalkMappedAttr(ma *MappedAttributeExpr, it MappedAttributeWalker) error { |
| 104 | o := AsObject(ma.Type) |
| 105 | for _, nat := range *o { |
| 106 | if err := it(nat.Name, ma.ElemName(nat.Name), nat.Attribute); err != nil { |
| 107 | return err |
| 108 | } |
| 109 | } |
| 110 | return nil |
| 111 | } |
| 112 | |
| 113 | // Map records the element name of one of the child attributes. |
| 114 | // Map panics if attName is not the name of a child attribute. |
no test coverage detected