Del removes a member from the ordered list.
(key string)
| 45 | |
| 46 | // Del removes a member from the ordered list. |
| 47 | func (d *Dictionary) Del(key string) bool { |
| 48 | if _, ok := d.values[key]; !ok { |
| 49 | return false |
| 50 | } |
| 51 | |
| 52 | for i, k := range d.names { |
| 53 | if k == key { |
| 54 | d.names = append(d.names[:i], d.names[i+1:]...) |
| 55 | |
| 56 | break |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | delete(d.values, key) |
| 61 | |
| 62 | return true |
| 63 | } |
| 64 | |
| 65 | // Names retrieves the list of member names in the appropriate order. |
| 66 | func (d *Dictionary) Names() []string { |
no outgoing calls