(attr string)
| 196 | } |
| 197 | |
| 198 | func (enc *encoder) idForAttr(attr string) uint16 { |
| 199 | if attr == "uid" && enc.uidAttr > 0 { |
| 200 | return enc.uidAttr |
| 201 | } |
| 202 | if id, ok := enc.attrMap[attr]; ok { |
| 203 | return id |
| 204 | } |
| 205 | |
| 206 | enc.idSlice = append(enc.idSlice, attr) |
| 207 | enc.attrMap[attr] = uint16(len(enc.idSlice) - 1) // TODO(Ashish): check for overflow. |
| 208 | return uint16(len(enc.idSlice) - 1) |
| 209 | } |
| 210 | |
| 211 | func (enc *encoder) attrForID(id uint16) string { |
| 212 | // For now we are not returning error from here. |
no outgoing calls