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

predicates without quoting strings #28

Open flashpixx opened 4 years ago

flashpixx commented 4 years ago

Hello,

I'm using the call predicate.TextContains with that call .Has("lastName", predicate.TextContains("t") and this creates an error, because the passed variable content will not be quoted, I must replace it with .Has("lastName", predicate.TextContains("\"t\"")` .

In my opinion the definition of the function seems not be correct:

func TextContains(str string) *Predicate {
    s := "textContains(" + str + ")"
    a := Predicate(s)
    return &a
}

The fixed definition of the first function line should be

s := "textContains(\"" + str + "\")"

Other calls can be create similar issues.

Thx