GetFacts implementation that looks up facts from an in-memory map.
(a ast.Atom, fn func(ast.Atom) error)
| 136 | |
| 137 | // GetFacts implementation that looks up facts from an in-memory map. |
| 138 | func (s SimpleInMemoryStore) GetFacts(a ast.Atom, fn func(ast.Atom) error) error { |
| 139 | for _, fact := range s.shardsByPredicate[a.Predicate] { |
| 140 | if Matches(a.Args, fact.Args) { |
| 141 | if err := fn(fact); err != nil { |
| 142 | return err |
| 143 | } |
| 144 | } |
| 145 | } |
| 146 | return nil |
| 147 | } |
| 148 | |
| 149 | // EstimateFactCount returns the number of facts. |
| 150 | func (s SimpleInMemoryStore) EstimateFactCount() int { |