Remove removes the given object, if it exists
(id string)
| 43 | |
| 44 | // Remove removes the given object, if it exists |
| 45 | func (o *Objects) Remove(id string) bool { |
| 46 | idx, ok := o.Contains(id) |
| 47 | if !ok { |
| 48 | return false |
| 49 | } |
| 50 | |
| 51 | o.mutex.Lock() |
| 52 | defer o.mutex.Unlock() |
| 53 | o.ids = append(o.ids[:idx], o.ids[idx+1:]...) |
| 54 | |
| 55 | return true |
| 56 | } |
| 57 | |
| 58 | // Clear removes all the objects |
| 59 | func (o *Objects) Clear() { |