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

Method FindKey

expr/mapped_attribute.go:189–197  ·  view source on GitHub ↗

FindKey finds the given key in the mapped attribute expression. If key is found, it returns the transport element name of the key and true. Otherwise, it returns an empty string and false.

(keyName string)

Source from the content-addressed store, hash-verified

187// If key is found, it returns the transport element name of the key and true.
188// Otherwise, it returns an empty string and false.
189func (ma *MappedAttributeExpr) FindKey(keyName string) (string, bool) {
190 obj := AsObject(ma.Type)
191 for _, nat := range *obj {
192 if nat.Name == keyName {
193 return ma.ElemName(keyName), true
194 }
195 }
196 return "", false
197}
198
199// IsEmpty returns true if the mapped attribute contains no key.
200func (ma *MappedAttributeExpr) IsEmpty() bool {

Callers 2

findKeyFunction · 0.80
mapUnmappedAttrsMethod · 0.80

Calls 2

ElemNameMethod · 0.95
AsObjectFunction · 0.85

Tested by

no test coverage detected