MCPcopy
hub / github.com/google/mangle / Contains

Method Contains

factstore/temporal.go:430–443  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

428// Per the FactStore interface contract, errors are treated as "false".
429// Clients who need to distinguish "absent" from "error" should use GetFacts.
430func (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).
446func (a *TemporalFactStoreAdapter) GetFacts(query ast.Atom, fn func(ast.Atom) error) error {

Callers

nothing calls this directly

Calls 3

ContainsAtMethod · 0.65
GetAllFactsMethod · 0.65
EqualsMethod · 0.65

Tested by

no test coverage detected