northwesternmutual / grammes

A Go package built to communicate with Apache TinkerPop™ Graph computing framework using Gremlin; a graph traversal language used by graph databases such as JanusGraph®, MS Cosmos DB, AWS Neptune, and DataStax® Enterprise Graph.
Apache License 2.0
125 stars 45 forks source link

Unable to create an edge between two vertex with .To() #34

Open rtoscani opened 4 years ago

rtoscani commented 4 years ago

After using .To() method with a string as parameter, the string was not escaped in the query generation.

Code example:

g := grammes.Traversal()
g = g.V("jhon").As("p1")
vAs := "v1"
g = g.AddV("person").As(vAs).Property(token.ID, "alex").Property("date", date)
g = g.AddE("relates").From("p1").To(vAs).Property("date", date)

Result query is: g.V("jhon").as("p1").addV("person").as("v1").property(T.id,"alex").property("date","2020-09-18T17:02:48").addE("relates").from("p1").to(v1).property("date","2020-09-18T17:02:48")

Expected result: g.V("jhon").as("p1").addV("person").as("v1").property(T.id,"alex").property("date","2020-09-18T17:02:48").addE("relates").from("p1").to("v1").property("date","2020-09-18T17:02:48")