Skip to content
Snippets Groups Projects
Commit 8cfabdf6 authored by Pawan Rawal's avatar Pawan Rawal
Browse files

Storing string in value instead of byte slice for now

parent 3ee87845
No related branches found
No related tags found
No related merge requests found
...@@ -43,7 +43,7 @@ func (*Request) ProtoMessage() {} ...@@ -43,7 +43,7 @@ func (*Request) ProtoMessage() {}
func (*Request) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } func (*Request) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
type Value struct { type Value struct {
Binary []byte `protobuf:"bytes,1,opt,name=binary,proto3" json:"binary,omitempty"` Str string `protobuf:"bytes,1,opt,name=str" json:"str,omitempty"`
} }
func (m *Value) Reset() { *m = Value{} } func (m *Value) Reset() { *m = Value{} }
...@@ -156,22 +156,22 @@ var _DGraph_serviceDesc = grpc.ServiceDesc{ ...@@ -156,22 +156,22 @@ var _DGraph_serviceDesc = grpc.ServiceDesc{
} }
var fileDescriptor0 = []byte{ var fileDescriptor0 = []byte{
// 272 bytes of a gzipped FileDescriptorProto // 268 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x5c, 0x50, 0xc1, 0x4a, 0xc3, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x5c, 0x90, 0x41, 0x4f, 0x83, 0x40,
0x10, 0x35, 0x4d, 0x36, 0xda, 0x49, 0x51, 0x19, 0x45, 0x42, 0x15, 0x2c, 0x39, 0x68, 0x4f, 0x41, 0x10, 0x85, 0xa5, 0xb0, 0xd5, 0x0e, 0x46, 0xcd, 0xea, 0x01, 0xab, 0x89, 0xcd, 0x1e, 0xb4, 0x27,
0xe2, 0x45, 0xf4, 0xaa, 0x78, 0x10, 0x44, 0xf7, 0xe0, 0x3d, 0x31, 0x83, 0x5d, 0x2c, 0x49, 0xdc, 0x62, 0xf0, 0x62, 0xf4, 0xaa, 0xf1, 0x60, 0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d1, 0x95, 0x97, 0x5d, 0x40, 0x78, 0x7b, 0x6f, 0x25, 0x3c, 0xe8, 0x66, 0x74, 0xed, 0x25, 0x97, 0x30, 0xbe, 0x7b, 0x20, 0x24, 0xcf, 0x41, 0xbc, 0x50, 0x57,
0x03, 0xf1, 0x6c, 0x1b, 0xc3, 0x5d, 0x37, 0xeb, 0x7a, 0x9d, 0x0e, 0x63, 0x24, 0x5b, 0x45, 0xc8, 0x72, 0xaf, 0x9b, 0xed, 0x1a, 0x9d, 0x0e, 0x63, 0xa8, 0xad, 0xc5, 0x98, 0x9b, 0xbf, 0xfa, 0x0d,
0xfd, 0x5f, 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0xb8, 0x91, 0x31, 0x0d, 0x96, 0x01, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe1, 0x8a, 0xe7, 0x89, 0x90, 0x01, 0x00, 0x00,
} }
...@@ -13,7 +13,7 @@ message Request { ...@@ -13,7 +13,7 @@ message Request {
} }
message Value { message Value {
bytes binary = 1; string str = 1;
} }
message Node { message Node {
......
...@@ -332,12 +332,12 @@ func (g *SubGraph) preTraverse(uid uint64, dst *graph.Node) error { ...@@ -332,12 +332,12 @@ func (g *SubGraph) preTraverse(uid uint64, dst *graph.Node) error {
ival = "" ival = ""
} }
v.Binary = []byte(ival.(string)) v.Str = ival.(string)
properties[pc.Attr] = v properties[pc.Attr] = v
} }
} }
if val, ok := properties["_xid_"]; ok { if val, ok := properties["_xid_"]; ok {
dst.Xid = string(val.Binary) dst.Xid = val.Str
delete(properties, "_xid_") delete(properties, "_xid_")
} }
dst.Properties, dst.Children = properties, children dst.Properties, dst.Children = properties, children
......
...@@ -378,9 +378,9 @@ func TestToProtocolBuffer(t *testing.T) { ...@@ -378,9 +378,9 @@ func TestToProtocolBuffer(t *testing.T) {
t.Errorf("Expected values map to contain 3 properties, Got: %v", t.Errorf("Expected values map to contain 3 properties, Got: %v",
len(gr.Properties)) len(gr.Properties))
} }
if string(gr.Properties["name"].Binary) != "Michonne" { if string(gr.Properties["name"].Str) != "Michonne" {
t.Errorf("Expected property name to have value Michonne, Got: %v", t.Errorf("Expected property name to have value Michonne, Got: %v",
string(gr.Properties["name"].Binary)) string(gr.Properties["name"].Str))
} }
if len(gr.Children) != 10 { if len(gr.Children) != 10 {
t.Errorf("Expected 10 children, Got: %v", len(gr.Children)) t.Errorf("Expected 10 children, Got: %v", len(gr.Children))
...@@ -397,9 +397,9 @@ func TestToProtocolBuffer(t *testing.T) { ...@@ -397,9 +397,9 @@ func TestToProtocolBuffer(t *testing.T) {
t.Errorf("Expected values map to contain 1 property, Got: %v", t.Errorf("Expected values map to contain 1 property, Got: %v",
len(child.Properties)) len(child.Properties))
} }
if string(child.Properties["name"].Binary) != "Rick Grimes" { if string(child.Properties["name"].Str) != "Rick Grimes" {
t.Errorf("Expected property name to have value Rick Grimes, Got: %v", t.Errorf("Expected property name to have value Rick Grimes, Got: %v",
string(child.Properties["name"].Binary)) string(child.Properties["name"].Str))
} }
if len(child.Children) != 0 { if len(child.Children) != 0 {
t.Errorf("Expected 0 children, Got: %v", len(child.Children)) t.Errorf("Expected 0 children, Got: %v", len(child.Children))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment