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

Function WalkMappedAttr

expr/mapped_attribute.go:103–111  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

101// is no more attribute to iterate over or if the iterator function returns an
102// error in which case it returns the error.
103func 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.

Callers 6

paramsFromHeadersFunction · 0.92
headersFromAttrFunction · 0.92
PrepareMethod · 0.70
validateParamsMethod · 0.70

Calls 2

AsObjectFunction · 0.85
ElemNameMethod · 0.80

Tested by

no test coverage detected