GetFacts returns facts matching the query (respecting queryAt if set).
(query ast.Atom, fn func(ast.Atom) error)
| 444 | |
| 445 | // GetFacts returns facts matching the query (respecting queryAt if set). |
| 446 | func (a *TemporalFactStoreAdapter) GetFacts(query ast.Atom, fn func(ast.Atom) error) error { |
| 447 | seen := make(map[uint64]bool) |
| 448 | |
| 449 | callback := func(tf TemporalFact) error { |
| 450 | hash := tf.Atom.Hash() |
| 451 | if seen[hash] { |
| 452 | return nil |
| 453 | } |
| 454 | seen[hash] = true |
| 455 | return fn(tf.Atom) |
| 456 | } |
| 457 | |
| 458 | if a.queryAt != nil { |
| 459 | return a.temporal.GetFactsAt(query, *a.queryAt, callback) |
| 460 | } |
| 461 | return a.temporal.GetAllFacts(query, callback) |
| 462 | } |
| 463 | |
| 464 | // ListPredicates returns all predicates in the store. |
| 465 | func (a *TemporalFactStoreAdapter) ListPredicates() []ast.PredicateSym { |