From 3ee878454bc9513956c9a930a11abd20501a3a7f Mon Sep 17 00:00:00 2001 From: Pawan Rawal <pawan0201@gmail.com> Date: Tue, 3 May 2016 11:21:04 +0530 Subject: [PATCH] Changing xid to _xid_ --- query/query.go | 3 ++- query/query_test.go | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/query/query.go b/query/query.go index dd15bbdb..4a31ab5c 100644 --- a/query/query.go +++ b/query/query.go @@ -336,8 +336,9 @@ func (g *SubGraph) preTraverse(uid uint64, dst *graph.Node) error { properties[pc.Attr] = v } } - if val, ok := properties["xid"]; ok { + if val, ok := properties["_xid_"]; ok { dst.Xid = string(val.Binary) + delete(properties, "_xid_") } dst.Properties, dst.Children = properties, children return nil diff --git a/query/query_test.go b/query/query_test.go index 3b4f5ac6..4ca61bda 100644 --- a/query/query_test.go +++ b/query/query_test.go @@ -185,7 +185,7 @@ func populateGraph(t *testing.T) (string, *store.Store) { addEdge(t, edge, posting.GetOrCreate(posting.Key(31, "name"), ps)) edge.Value = "mich" - addEdge(t, edge, posting.GetOrCreate(posting.Key(1, "xid"), ps)) + addEdge(t, edge, posting.GetOrCreate(posting.Key(1, "_xid_"), ps)) return dir, ps } @@ -330,7 +330,7 @@ func TestToProtocolBuffer(t *testing.T) { query := ` { me(_uid_:0x01) { - xid + _xid_ name gender status @@ -374,8 +374,8 @@ func TestToProtocolBuffer(t *testing.T) { if gr.Xid != "mich" { t.Errorf("Expected xid mich, Got: %v", gr.Xid) } - if len(gr.Properties) != 4 { - t.Errorf("Expected values map to contain 4 properties, Got: %v", + if len(gr.Properties) != 3 { + t.Errorf("Expected values map to contain 3 properties, Got: %v", len(gr.Properties)) } if string(gr.Properties["name"].Binary) != "Michonne" { -- GitLab