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)
| 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. |
| 189 | func (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. |
| 200 | func (ma *MappedAttributeExpr) IsEmpty() bool { |
no test coverage detected