Contains returns true if the fact exists (respecting queryAt if set). Per the FactStore interface contract, errors are treated as "false". Clients who need to distinguish "absent" from "error" should use GetFacts.
(atom ast.Atom)
| 428 | // Per the FactStore interface contract, errors are treated as "false". |
| 429 | // Clients who need to distinguish "absent" from "error" should use GetFacts. |
| 430 | func (a *TemporalFactStoreAdapter) Contains(atom ast.Atom) bool { |
| 431 | if a.queryAt != nil { |
| 432 | return a.temporal.ContainsAt(atom, *a.queryAt) |
| 433 | } |
| 434 | // Without a query time, check if the fact exists with any interval |
| 435 | found := false |
| 436 | _ = a.temporal.GetAllFacts(atom, func(tf TemporalFact) error { |
| 437 | if tf.Atom.Equals(atom) { |
| 438 | found = true |
| 439 | } |
| 440 | return nil |
| 441 | }) |
| 442 | return found |
| 443 | } |
| 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 { |
nothing calls this directly
no test coverage detected