Remove removes the fact from the backing map.
(a ast.Atom)
| 171 | |
| 172 | // Remove removes the fact from the backing map. |
| 173 | func (s SimpleInMemoryStore) Remove(a ast.Atom) bool { |
| 174 | key := a.Hash() |
| 175 | if atoms, ok := s.shardsByPredicate[a.Predicate]; ok { |
| 176 | if _, ok := atoms[key]; ok { |
| 177 | delete(atoms, key) |
| 178 | if len(atoms) == 0 { |
| 179 | delete(s.shardsByPredicate, a.Predicate) |
| 180 | } |
| 181 | return true |
| 182 | } |
| 183 | } |
| 184 | return false |
| 185 | } |
| 186 | |
| 187 | // Contains returns true if this store contains this atom already. |
| 188 | func (s SimpleInMemoryStore) Contains(a ast.Atom) bool { |