MCPcopy Index your code
hub / github.com/google/mangle / GetFacts

Method GetFacts

factstore/factstore.go:138–147  ·  view source on GitHub ↗

GetFacts implementation that looks up facts from an in-memory map.

(a ast.Atom, fn func(ast.Atom) error)

Source from the content-addressed store, hash-verified

136
137// GetFacts implementation that looks up facts from an in-memory map.
138func (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.
150func (s SimpleInMemoryStore) EstimateFactCount() int {

Callers 4

TestRoundTripFunction · 0.95
runEvalFunction · 0.95
TestTransformFunction · 0.95
TestEmptyArrayProgramFunction · 0.95

Calls 1

MatchesFunction · 0.85

Tested by 4

TestRoundTripFunction · 0.76
runEvalFunction · 0.76
TestTransformFunction · 0.76
TestEmptyArrayProgramFunction · 0.76