Merge merges contents of another temporal store into this one. Returns an error if the interval limit is exceeded for any atom.
(other ReadOnlyTemporalFactStore)
| 375 | // Merge merges contents of another temporal store into this one. |
| 376 | // Returns an error if the interval limit is exceeded for any atom. |
| 377 | func (s *TemporalStore) Merge(other ReadOnlyTemporalFactStore) error { |
| 378 | var mergeErr error |
| 379 | for _, pred := range other.ListPredicates() { |
| 380 | query := ast.NewQuery(pred) |
| 381 | other.GetAllFacts(query, func(tf TemporalFact) error { |
| 382 | _, err := s.Add(tf.Atom, tf.Interval) |
| 383 | if err != nil { |
| 384 | mergeErr = err |
| 385 | return err // Stop iteration on error |
| 386 | } |
| 387 | return nil |
| 388 | }) |
| 389 | if mergeErr != nil { |
| 390 | return mergeErr |
| 391 | } |
| 392 | } |
| 393 | return nil |
| 394 | } |
| 395 | |
| 396 | // TemporalFactStoreAdapter wraps a TemporalFactStore to provide |
| 397 | // a standard FactStore interface. Facts are returned without |
nothing calls this directly
no test coverage detected