Don’t use diffing in SQL export
This commit is contained in:
parent
6a236b27b2
commit
0ea0942378
1 changed files with 4 additions and 28 deletions
24
db/export.go
24
db/export.go
|
@ -18,14 +18,11 @@ import (
|
|||
"fmt"
|
||||
"math"
|
||||
|
||||
"encoding/json"
|
||||
|
||||
"github.com/abcum/fibre"
|
||||
"github.com/abcum/surreal/cnf"
|
||||
"github.com/abcum/surreal/kvs"
|
||||
"github.com/abcum/surreal/sql"
|
||||
"github.com/abcum/surreal/util/data"
|
||||
"github.com/abcum/surreal/util/diff"
|
||||
"github.com/abcum/surreal/util/keys"
|
||||
)
|
||||
|
||||
|
@ -260,9 +257,7 @@ TB:
|
|||
// then loop over all the items and
|
||||
// process the records.
|
||||
|
||||
o := data.New()
|
||||
n := data.New()
|
||||
p := new(keys.Thing)
|
||||
|
||||
for _, kv := range vls {
|
||||
|
||||
|
@ -275,8 +270,6 @@ TB:
|
|||
|
||||
n = data.New().Decode(kv.Val())
|
||||
|
||||
if p.TB != k.TB || p.ID != k.ID {
|
||||
|
||||
j, _ := n.MarshalJSON()
|
||||
|
||||
if TB.Vers {
|
||||
|
@ -285,21 +278,6 @@ TB:
|
|||
fmt.Fprintf(w, "UPDATE ⟨%s⟩:⟨%s⟩ CONTENT %s;\n", k.TB, k.ID, j)
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
a, _ := o.Data().(map[string]interface{})
|
||||
b, _ := n.Data().(map[string]interface{})
|
||||
c := diff.Diff(a, b)
|
||||
j, _ := json.Marshal(c)
|
||||
|
||||
if TB.Vers {
|
||||
fmt.Fprintf(w, "UPDATE ⟨%s⟩:⟨%s⟩ DIFF %s VERSION %d;\n", k.TB, k.ID, j, v)
|
||||
} else {
|
||||
fmt.Fprintf(w, "UPDATE ⟨%s⟩:⟨%s⟩ DIFF %s;\n", k.TB, k.ID, j)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if TB.Vers {
|
||||
|
@ -310,8 +288,6 @@ TB:
|
|||
|
||||
}
|
||||
|
||||
p, o = k, n
|
||||
|
||||
}
|
||||
|
||||
// When we loop around, we will use
|
||||
|
|
Loading…
Reference in a new issue