From a8137134e31e506abeb19d797ebfa1076faf56f7 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Fri, 17 Nov 2017 12:41:35 +0000 Subject: [PATCH] Ensure erased document is nil not empty map --- db/document.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/db/document.go b/db/document.go index 424c4ab3..dc630b8d 100644 --- a/db/document.go +++ b/db/document.go @@ -89,7 +89,7 @@ func (d *document) clear() { } func (d *document) erase() (err error) { - d.current.Reset() + d.current = data.Consume(nil) return } @@ -276,15 +276,15 @@ func (d *document) setup() (err error) { } func (d *document) changed() bool { - a := d.initial.Data().(map[string]interface{}) - b := d.current.Data().(map[string]interface{}) + a, _ := d.initial.Data().(map[string]interface{}) + b, _ := d.current.Data().(map[string]interface{}) c := diff.Diff(a, b) return len(c) > 0 } func (d *document) diff() *data.Doc { - a := d.initial.Data().(map[string]interface{}) - b := d.current.Data().(map[string]interface{}) + a, _ := d.initial.Data().(map[string]interface{}) + b, _ := d.current.Data().(map[string]interface{}) if c := diff.Diff(a, b); len(c) > 0 { return data.Consume(c) }