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

AddProperty doesn't work if you have `"`s in the string. #9

Closed brugnara closed 4 years ago

brugnara commented 4 years ago

The original lib causes an error while doing this:

body := "{\"a\":\"b\"}"
vertex.AddProperty(client, "json", body)

# generated query is
# g.V().hasId("..").property("json", "{"a":"b"}")

# this patch, causes the generated query to be right:
# g.V().hasId("...").property("json", "{\"a\":\"b\"}")
damienstamates commented 4 years ago

Nice contribution @brugnara! I saw your comment on #5 so I look forward to seeing any other patches you make for AWS Neptune compatibility. I'd be interested in helping more with that work and doubling down on getting MS Cosmos DB working as well.

brugnara commented 4 years ago

@damienstamates sadly my branch is not working with Neptune but with Tinkerpop and UUID as IDs only. Errors are on JSON.Unmarshal that fails when data comes from the DB and are going to be parsed into structs.

# error while doing `AddVertex`:
json: cannot unmarshal string into Go struct field VertexValue.id of type model.ID

As for now I moved to github.com/schwartzmx/gremtune but it is very chaotic for reading data from Neptune but I needed something working due to time requirements :disappointed:

I'll wait for your feedback about this and #5 as you pointed out.

Many thanks and have a nice Christmas :+1: