Improve Transaction: deduplicate quads, allow adding/removing a quad in the same tx
This commit is contained in:
parent
b74f8f1340
commit
45d96e14ec
3 changed files with 105 additions and 19 deletions
|
|
@ -109,9 +109,11 @@ func (s *Single) Close() error {
|
|||
|
||||
func (s *Single) ApplyTransaction(t *graph.Transaction) error {
|
||||
ts := time.Now()
|
||||
for i := 0; i < len(t.Deltas); i++ {
|
||||
t.Deltas[i].ID = s.currentID.Next()
|
||||
t.Deltas[i].Timestamp = ts
|
||||
deltas := make([]graph.Delta, 0, len(t.Deltas))
|
||||
for d := range t.Deltas {
|
||||
d.ID = s.currentID.Next()
|
||||
d.Timestamp = ts
|
||||
deltas = append(deltas, d)
|
||||
}
|
||||
return s.qs.ApplyDeltas(t.Deltas, s.ignoreOpts)
|
||||
return s.qs.ApplyDeltas(deltas, s.ignoreOpts)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue