From 0ea0942378abd63f0a0a7ec88b1f2560dd13592b Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Thu, 3 Oct 2019 19:15:36 +0100 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20use=20diffing=20in=20SQL=20expo?= =?UTF-8?q?rt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/export.go | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/db/export.go b/db/export.go index 34dbfeee..dd974543 100644 --- a/db/export.go +++ b/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,29 +270,12 @@ TB: n = data.New().Decode(kv.Val()) - if p.TB != k.TB || p.ID != k.ID { - - j, _ := n.MarshalJSON() - - if TB.Vers { - fmt.Fprintf(w, "UPDATE ⟨%s⟩:⟨%s⟩ CONTENT %s VERSION %d;\n", k.TB, k.ID, j, v) - } else { - fmt.Fprintf(w, "UPDATE ⟨%s⟩:⟨%s⟩ CONTENT %s;\n", k.TB, k.ID, j) - } + j, _ := n.MarshalJSON() + if TB.Vers { + fmt.Fprintf(w, "UPDATE ⟨%s⟩:⟨%s⟩ CONTENT %s VERSION %d;\n", k.TB, k.ID, j, v) } 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) - } - + fmt.Fprintf(w, "UPDATE ⟨%s⟩:⟨%s⟩ CONTENT %s;\n", k.TB, k.ID, j) } } else { @@ -310,8 +288,6 @@ TB: } - p, o = k, n - } // When we loop around, we will use