(a ast.Atom, fn func(ast.Atom) error)
| 398 | } |
| 399 | |
| 400 | func (s IndexedInMemoryStore) getFactsOfFirstVariable(a ast.Atom, fn func(ast.Atom) error) error { |
| 401 | for _, shard := range s.shardsByPredicate[a.Predicate] { |
| 402 | for _, fact := range shard { |
| 403 | if Matches(a.Args[1:], fact.Args[1:]) { |
| 404 | if err := fn(fact); err != nil { |
| 405 | return err |
| 406 | } |
| 407 | } |
| 408 | } |
| 409 | } |
| 410 | return nil |
| 411 | } |
| 412 | |
| 413 | // GetFacts implementation that looks up facts from an in-memory map. |
| 414 | func (s IndexedInMemoryStore) GetFacts(a ast.Atom, fn func(ast.Atom) error) error { |