Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion model/vertex_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func (v *Vertex) AddEdge(client queryClient, label string, outVID interface{}, p
}

var query = newTrav().V().HasID(v.ID()).AddE(label).To(newTrav().V().HasID(outVID).Raw())
// query := fmt.Sprintf("g.V().hasId(%v).addE(\"%s\").to(V().hasId(%v))", v.ID(), label, outVID)
// query := fmt.Sprintf("g.V().hasId(%v).addE('%s').to(V().hasId(%v))", v.ID(), label, outVID)

if len(properties)%2 != 0 {
return Edge{}, gremerror.NewGrammesError("AddEdge", gremerror.ErrOddNumberOfParameters)
Expand Down
4 changes: 2 additions & 2 deletions query/graph/addvertex.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (graph String) AddVertex(params ...interface{}) String {
switch params[0].(type) {
case string:
// custom property or other strings.
graph = graph.append("\"" + params[0].(string) + "\"")
graph = graph.append("'" + params[0].(string) + "'")
default:
// token or other types.
graph = graph.append(fmt.Sprintf("%v", params[0]))
Expand All @@ -48,7 +48,7 @@ func (graph String) AddVertex(params ...interface{}) String {
switch p.(type) {
case string:
// custom property or other strings.
graph = graph.append(",\"" + p.(string) + "\"")
graph = graph.append(",'" + p.(string) + "'")
default:
// Token or other types.
graph = graph.append(fmt.Sprintf(",%v", p))
Expand Down
6 changes: 3 additions & 3 deletions query/graph/addvertex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@ func TestAddVertex(t *testing.T) {
Convey("When 'AddVertex' is called with a Token and Label string", func() {
result := g.AddVertex(T.Label, "testinglabel")
Convey("Then result should equal 'graph.addVertex(T.label,'testinglabel')'", func() {
So(result.String(), ShouldEqual, "graph.addVertex(T.label,\"testinglabel\")")
So(result.String(), ShouldEqual, "graph.addVertex(T.label,'testinglabel')")
})
})
Convey("When 'AddVertex' is called with a string and a Token", func() {
result := g.AddVertex("teststring", "testval", T.Key)
Convey("Then result should equal 'graph.addVertex('teststring','testval',T.key)'", func() {
So(result.String(), ShouldEqual, "graph.addVertex(\"teststring\",\"testval\",T.key)")
So(result.String(), ShouldEqual, "graph.addVertex('teststring','testval',T.key)")
})
})
Convey("When 'AddVertex' is called with a Token, Label string, "+
"and property strings", func() {
result := g.AddVertex(T.Label, "testinglabel", "testkey", "testval")
Convey("Then result should equal "+
"'graph.addVertex(T.label,'testinglabel','testkey','testval')'", func() {
So(result.String(), ShouldEqual, "graph.addVertex(T.label,\"testinglabel\",\"testkey\",\"testval\")")
So(result.String(), ShouldEqual, "graph.addVertex(T.label,'testinglabel','testkey','testval')")
})
})
})
Expand Down
2 changes: 1 addition & 1 deletion query/graph/makeedgelabel.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ package graph

// MakeEdgeLabel create a label for a new edge.
func (graph String) MakeEdgeLabel(label string) String {
graph = graph.append(".makeEdgeLabel(\"" + label + "\")")
graph = graph.append(".makeEdgeLabel('" + label + "')")

return graph
}
2 changes: 1 addition & 1 deletion query/graph/makeedgelabel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestMakeEdgeLabel(t *testing.T) {
Convey("When 'MakeEdgeLabel' is called with a label string", func() {
result := graph.MakeEdgeLabel("label")
Convey("Then result should equal 'graph.makeEdgeLabel('label')'", func() {
So(result.String(), ShouldEqual, "graph.makeEdgeLabel(\"label\")")
So(result.String(), ShouldEqual, "graph.makeEdgeLabel('label')")
})
})
})
Expand Down
2 changes: 1 addition & 1 deletion query/graph/makepropertykey.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

// MakePropertyKey create a label for a new edge.
func (graph String) MakePropertyKey(label string, datatype datatype.DataType, cardinality cardinality.Cardinality) String {
graph = graph.append(".makePropertyKey(\"" + label + "\")")
graph = graph.append(".makePropertyKey('" + label + "')")
graph = graph.append(fmt.Sprintf(".dataType(%v).cardinality(%v)", datatype, cardinality))

return graph
Expand Down
2 changes: 1 addition & 1 deletion query/graph/makepropertykey_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestMakePropertyKey(t *testing.T) {
var cr = cardinality.List
result := g.MakePropertyKey("labelTest", dt, cr)
Convey("Then result should equal 'graph.makePropertyKey('labelTest').dataType(String.class).cardinality(list)'", func() {
So(result.String(), ShouldEqual, "graph.makePropertyKey(\"labelTest\").dataType(String.class).cardinality(list)")
So(result.String(), ShouldEqual, "graph.makePropertyKey('labelTest').dataType(String.class).cardinality(list)")
})
})
})
Expand Down
2 changes: 1 addition & 1 deletion query/graph/makevertexlabel.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ package graph

// MakeVertexLabel will create a label for a vertex in the graph.
func (graph String) MakeVertexLabel(name string) String {
graph = graph.append(".makeVertexLabel(\"" + name + "\")")
graph = graph.append(".makeVertexLabel('" + name + "')")
return graph
}
2 changes: 1 addition & 1 deletion query/graph/makevertexlabel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestMakeVertexLabel(t *testing.T) {
Convey("When 'MakeVertexLabel' is called with a name string", func() {
result := graph.MakeVertexLabel("name")
Convey("Then result should equal 'graph.makeVertexLabel('name')'", func() {
So(result.String(), ShouldEqual, "graph.makeVertexLabel(\"name\")")
So(result.String(), ShouldEqual, "graph.makeVertexLabel('name')")
})
})
})
Expand Down
2 changes: 1 addition & 1 deletion query/predicate/comparepredicate.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func Within(params ...interface{}) *Predicate {
buffer.WriteString(sep)
switch t := p.(type) {
case string:
buffer.WriteString("\"" + t + "\"")
buffer.WriteString("'" + t + "'")
default:
buffer.WriteString(fmt.Sprintf("%v", t))
}
Expand Down
2 changes: 1 addition & 1 deletion query/traversal/addedge.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (g String) AddE(param interface{}) String {
case String:
g = g.append(".addE(" + param.(String).Raw().String() + ")")
case string:
g = g.append(".addE(\"" + param.(string) + "\")")
g = g.append(".addE('" + param.(string) + "')")
default:
g.AddStep("addE")
}
Expand Down
6 changes: 3 additions & 3 deletions query/traversal/addedge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ func TestAddE(t *testing.T) {
g := NewTraversal()
Convey("When 'AddE' is called with a traversal string", func() {
res := g.AddE(NewTraversal().Label())
Convey("Then the graph traversal should be 'g.addE(\"test\")'", func() {
Convey("Then the graph traversal should be 'g.addE('test')'", func() {
So(res.String(), ShouldEqual, "g.addE(label())")
})
})
Convey("When 'AddE' is called with a string", func() {
res := g.AddE("somethingelse")
Convey("Then the graph traversal should be 'g.addE(\"somethingelse\")'", func() {
So(res.String(), ShouldEqual, "g.addE(\"somethingelse\")")
Convey("Then the graph traversal should be 'g.addE('somethingelse')'", func() {
So(res.String(), ShouldEqual, "g.addE('somethingelse')")
})
})
Convey("When 'AddE' is called with anything else", func() {
Expand Down
4 changes: 2 additions & 2 deletions query/traversal/addproperty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ func TestProperty(t *testing.T) {
Convey("When 'Property' is called with object strings", func() {
result := g.Property("obj1", "obj2", "obj3", "obj4")
Convey("Then result should equal 'g.property('obj1','obj2','obj3','obj4')", func() {
So(result.String(), ShouldEqual, "g.property(\"obj1\",\"obj2\",\"obj3\",\"obj4\")")
So(result.String(), ShouldEqual, "g.property('obj1','obj2','obj3','obj4')")
})
})
Convey("When 'Property' is called with object strings and cardinality", func() {
result := g.Property(cardinality.Set, "obj1", "obj2")
Convey("Then result should equal 'g.property(set,'obj1','obj2')'", func() {
So(result.String(), ShouldEqual, "g.property(set,\"obj1\",\"obj2\")")
So(result.String(), ShouldEqual, "g.property(set,'obj1','obj2')")
})
})
Convey("When 'Property' is called with object strings and ints", func() {
Expand Down
2 changes: 1 addition & 1 deletion query/traversal/addvertex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestAddV(t *testing.T) {
Convey("When 'AddV' is called with a string", func() {
result := g.AddV("myVertex")
Convey("Then result should equal 'g.addV('myVertex')'", func() {
So(result.String(), ShouldEqual, "g.addV(\"myVertex\")")
So(result.String(), ShouldEqual, "g.addV('myVertex')")
})
})

Expand Down
2 changes: 1 addition & 1 deletion query/traversal/aggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ package traversal
// Signatures:
// Aggregate(string)
func (g String) Aggregate(str string) String {
g = g.append(".aggregate(\"" + str + "\")")
g = g.append(".aggregate('" + str + "')")

return g
}
2 changes: 1 addition & 1 deletion query/traversal/aggregate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestAggregate(t *testing.T) {
Convey("When 'Aggregate' is called with a string", func() {
result := g.Aggregate("test")
Convey("Then result should equal 'g.aggregate('test')'", func() {
So(result.String(), ShouldEqual, "g.aggregate(\"test\")")
So(result.String(), ShouldEqual, "g.aggregate('test')")
})
})
})
Expand Down
4 changes: 2 additions & 2 deletions query/traversal/as.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ func (g String) As(labels ...string) String {
}

if len(labels) > 0 {
g = g.append("\"" + labels[0] + "\"")
g = g.append("'" + labels[0] + "'")
}

if len(labels) > 1 {
for _, v := range labels[1:] {
g = g.append(",\"" + v + "\"")
g = g.append(",'" + v + "'")
}
}

Expand Down
2 changes: 1 addition & 1 deletion query/traversal/as_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestAs(t *testing.T) {
Convey("When 'As' is called with multiple strings", func() {
result := g.As("test1", "test2")
Convey("Then result should equal 'g.as('test1','test2')'", func() {
So(result.String(), ShouldEqual, "g.as(\"test1\",\"test2\")")
So(result.String(), ShouldEqual, "g.as('test1','test2')")
})
})

Expand Down
8 changes: 4 additions & 4 deletions query/traversal/both.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ func (g String) Both(labels ...string) String {
g = g.append(".both(")

if len(labels) > 0 {
g = g.append("\"" + labels[0] + "\"")
g = g.append("'" + labels[0] + "'")

if len(labels) > 1 {
for _, v := range labels[1:] {
g = g.append(",\"" + v + "\"")
g = g.append(",'" + v + "'")
}
}
}
Expand All @@ -44,11 +44,11 @@ func (g String) BothE(labels ...string) String {
g = g.append(".bothE(")

if len(labels) > 0 {
g = g.append("\"" + labels[0] + "\"")
g = g.append("'" + labels[0] + "'")

if len(labels) > 1 {
for _, v := range labels[1:] {
g = g.append(",\"" + v + "\"")
g = g.append(",'" + v + "'")
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions query/traversal/both_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func TestBoth(t *testing.T) {
Convey("When 'Both' is called with an multiple parametrs", func() {
result := g.Both("lblTest1", "lblTest2")
Convey("Then result should equal 'g.both('lblTest1','lblTest2')'", func() {
So(result.String(), ShouldEqual, "g.both(\"lblTest1\",\"lblTest2\")")
So(result.String(), ShouldEqual, "g.both('lblTest1','lblTest2')")
})
})
})
Expand All @@ -24,7 +24,7 @@ func TestBothE(t *testing.T) {
Convey("When 'BothE' is called with an multiple parametrs", func() {
result := g.BothE("lblTest1", "lblTest2")
Convey("Then result should equal 'g.bothE('lblTest1','lblTest2')'", func() {
So(result.String(), ShouldEqual, "g.bothE(\"lblTest1\",\"lblTest2\")")
So(result.String(), ShouldEqual, "g.bothE('lblTest1','lblTest2')")
})
})
})
Expand Down
10 changes: 5 additions & 5 deletions query/traversal/by_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ func TestBy(t *testing.T) {
Convey("When 'By' is called with multiple strings", func() {
result := g.By("test1", "test2", "test3")
Convey("Then result should equal 'g.by('test1','test2','test3')'", func() {
So(result.String(), ShouldEqual, "g.by(\"test1\",\"test2\",\"test3\")")
So(result.String(), ShouldEqual, "g.by('test1','test2','test3')")
})
})

Convey("When 'By' is called with one string", func() {
result := g.By("test")
Convey("Then result should equal 'g.by('test')'", func() {
So(result.String(), ShouldEqual, "g.by(\"test\")")
So(result.String(), ShouldEqual, "g.by('test')")
})
})

Expand All @@ -49,10 +49,10 @@ func TestBy(t *testing.T) {
So(result.String(), ShouldEqual, "g.by()")
})
})
Convey("When 'By' is called with order().by(\"id\", desc)", func() {
Convey("When 'By' is called with order().by('id', desc)", func() {
result := g.By("id", Custom("desc"))
Convey("Then result should equal 'g.by(\"id\",desc)'", func() {
So(result.String(), ShouldEqual, "g.by(\"id\",desc)")
Convey("Then result should equal 'g.by('id',desc)'", func() {
So(result.String(), ShouldEqual, "g.by('id',desc)")
})
})
})
Expand Down
4 changes: 2 additions & 2 deletions query/traversal/cap.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ package traversal
// Signatures:
// Cap(string, ...string)
func (g String) Cap(str string, optStrings ...string) String {
g = g.append(".cap(\"" + str + "\"")
g = g.append(".cap('" + str + "'")

if len(optStrings) > 0 {
for _, v := range optStrings {
g = g.append(",\"" + v + "\"")
g = g.append(",'" + v + "'")
}
}

Expand Down
4 changes: 2 additions & 2 deletions query/traversal/cap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ func TestCap(t *testing.T) {
Convey("When 'Cap' is called with optStrings = nil", func() {
result := g.Cap("test1")
Convey("Then result should equal 'g.cap('test1')'", func() {
So(result.String(), ShouldEqual, "g.cap(\"test1\")")
So(result.String(), ShouldEqual, "g.cap('test1')")
})
})

Convey("When 'Cap' is called with multiple strings", func() {
result := g.Cap("test1", "test2", "test3")
Convey("Then result should equal 'g.cap('test1','test2','test3')'", func() {
So(result.String(), ShouldEqual, "g.cap(\"test1\",\"test2\",\"test3\")")
So(result.String(), ShouldEqual, "g.cap('test1','test2','test3')")
})
})
})
Expand Down
4 changes: 2 additions & 2 deletions query/traversal/dedup.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (g String) Dedup(params ...interface{}) String {
// if len(params) > 0 {
// switch params[0].(type) {
// case string:
// g = g.append("\"" + params[0].(string) + "\"")
// g = g.append("'" + params[0].(string) + "'")
// case scope.Scope:
// g = g.append(params[0].(scope.Scope).String())
// default:
Expand All @@ -42,7 +42,7 @@ func (g String) Dedup(params ...interface{}) String {

// if len(params) > 1 {
// for _, v := range params[1:] {
// g = g.append(",\"" + v.(string) + "\"")
// g = g.append(",'" + v.(string) + "'")
// }
// }

Expand Down
4 changes: 2 additions & 2 deletions query/traversal/dedup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ func TestDedup(t *testing.T) {
Convey("When 'Dedup' is called with object strings", func() {
result := g.Dedup("obj1", "obj2", "obj3")
Convey("Then result should equal 'g.dedup(obj1,obj2,obj3,obj4)'", func() {
So(result.String(), ShouldEqual, "g.dedup(\"obj1\",\"obj2\",\"obj3\")")
So(result.String(), ShouldEqual, "g.dedup('obj1','obj2','obj3')")
})
})

Convey("When 'Dedup' is called with interface", func() {
result := g.Dedup(scope.Global, "obj")
Convey("Then result should equal 'g.dedup(global,'obj')'", func() {
So(result.String(), ShouldEqual, "g.dedup(global,\"obj\")")
So(result.String(), ShouldEqual, "g.dedup(global,'obj')")
})
})

Expand Down
2 changes: 1 addition & 1 deletion query/traversal/fold_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestFold(t *testing.T) {
Convey("When 'Fold' is called with a string", func() {
result := g.Fold("foldTest")
Convey("Then result should equal 'g.fold('foldTest')'", func() {
So(result.String(), ShouldEqual, "g.fold(\"foldTest\")")
So(result.String(), ShouldEqual, "g.fold('foldTest')")
})
})

Expand Down
2 changes: 1 addition & 1 deletion query/traversal/from_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestFrom(t *testing.T) {
Convey("When 'From' is called with a string", func() {
result := g.From("fromTest")
Convey("Then result should equal 'g.from(fromTest)'", func() {
So(result.String(), ShouldEqual, "g.from(\"fromTest\")")
So(result.String(), ShouldEqual, "g.from('fromTest')")
})
})

Expand Down
2 changes: 1 addition & 1 deletion query/traversal/group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestGroup(t *testing.T) {
Convey("When 'Group' is called with one string", func() {
result := g.Group("test")
Convey("Then result should equal 'g.group('test')'", func() {
So(result.String(), ShouldEqual, "g.group(\"test\")")
So(result.String(), ShouldEqual, "g.group('test')")
})
})

Expand Down
2 changes: 1 addition & 1 deletion query/traversal/groupcount_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestGroupCount(t *testing.T) {
Convey("When 'Group' is called with one string", func() {
result := g.GroupCount("test")
Convey("Then result should equal 'g.groupCount('test')'", func() {
So(result.String(), ShouldEqual, "g.groupCount(\"test\")")
So(result.String(), ShouldEqual, "g.groupCount('test')")
})
})

Expand Down
Loading