Use reflect to check for document changes
This commit is contained in:
parent
5c4c94feb9
commit
0392aa904c
2 changed files with 3 additions and 5 deletions
|
@ -18,11 +18,11 @@ import (
|
|||
"fmt"
|
||||
|
||||
"context"
|
||||
"reflect"
|
||||
|
||||
"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/indx"
|
||||
"github.com/abcum/surreal/util/keys"
|
||||
)
|
||||
|
@ -207,10 +207,7 @@ func (d *document) forced(ctx context.Context) bool {
|
|||
}
|
||||
|
||||
func (d *document) hasChanged(ctx context.Context) bool {
|
||||
a, _ := d.initial.Data().(map[string]interface{})
|
||||
b, _ := d.current.Data().(map[string]interface{})
|
||||
c := diff.Diff(a, b)
|
||||
return len(c) > 0
|
||||
return reflect.DeepEqual(d.initial, d.current) == false
|
||||
}
|
||||
|
||||
func (d *document) shouldDrop(ctx context.Context) (bool, error) {
|
||||
|
|
|
@ -106,6 +106,7 @@ func (d *document) yield(ctx context.Context, stm sql.Statement, output sql.Toke
|
|||
switch output {
|
||||
default:
|
||||
return nil, nil
|
||||
|
||||
case sql.DIFF:
|
||||
|
||||
old, err := d.cold(ctx)
|
||||
|
|
Loading…
Reference in a new issue