Cole-Greer commented on code in PR #3292:
URL: https://github.com/apache/tinkerpop/pull/3292#discussion_r2729100773
##########
gremlin-go/driver/gremlinlang_test.go:
##########
@@ -448,191 +451,228 @@ func Test_translator_Translate(t *testing.T) {
Local(T__.Union(T__.Path().By("code").By("dist"), T__.Sack()).Fold()).
Limit(10)
},
- equals:
"g.withSack(0).V('3').repeat(outE('route').sack(sum).by('dist').inV()).until(has('code','AGR').or().loops().is(4)).has('code','AGR').local(union(path().by('code').by('dist'),sack()).fold()).limit(10)",
+ equals:
"g.withSack(0).V(\"3\").repeat(__.outE(\"route\").sack(Operator.sum).by(\"dist\").inV()).until(__.has(\"code\",\"AGR\").or().loops().is(4)).has(\"code\",\"AGR\").local(__.union(__.path().by(\"code\").by(\"dist\"),__.sack()).fold()).limit(10)",
},
{
assert: func(g *GraphTraversalSource) *GraphTraversal {
return
g.AddV().As("a").AddV().As("b").AddE("knows").From("a").To("b")
},
- equals:
"g.addV().as('a').addV().as('b').addE('knows').from('a').to('b')",
+ equals:
"g.addV().as(\"a\").addV().as(\"b\").addE(\"knows\").from(\"a\").to(\"b\")",
},
{
assert: func(g *GraphTraversalSource) *GraphTraversal {
return
g.AddV("Person").As("a").AddV("Person").As("b").AddE("knows").From("a").To("b")
},
- equals:
"g.addV('Person').as('a').addV('Person').as('b').addE('knows').from('a').to('b')",
+ equals:
"g.addV(\"Person\").as(\"a\").addV(\"Person\").as(\"b\").addE(\"knows\").from(\"a\").to(\"b\")",
},
{
assert: func(g *GraphTraversalSource) *GraphTraversal {
return g.V("3").Project("Out",
"In").By(T__.Out().Count()).By(T__.In().Count())
},
- equals:
"g.V('3').project('Out','In').by(out().count()).by(in().count())",
+ equals:
"g.V(\"3\").project(\"Out\",\"In\").by(__.out().count()).by(__.in().count())",
},
{
assert: func(g *GraphTraversalSource) *GraphTraversal {
return
g.V("44").Out().Aggregate("a").Out().Where(P.Within("a")).Path()
},
- equals:
"g.V('44').out().aggregate('a').out().where(within('a')).path()",
+ equals:
"g.V(\"44\").out().aggregate(\"a\").out().where(within(\"a\")).path()",
},
{
assert: func(g *GraphTraversalSource) *GraphTraversal {
return g.V().Has("date", time.Date(2021, 2, 22,
0, 0, 0, 0, time.UTC))
},
- equals: "g.V().has('date',new Date(121,2,22,0,0,0))",
+ equals:
"g.V().has(\"date\",datetime(\"2021-02-22T00:00:00Z\"))",
},
{
assert: func(g *GraphTraversalSource) *GraphTraversal {
return g.V().Has("date",
P.Within(time.Date(2021, 2, 22, 0, 0, 0, 0, time.UTC), time.Date(2021, 1, 1, 0,
0, 0, 0, time.UTC)))
},
- equals: "g.V().has('date',within([new
Date(121,2,22,0,0,0),new Date(121,1,1,0,0,0)]))",
+ equals:
"g.V().has(\"date\",within([datetime(\"2021-02-22T00:00:00Z\"),datetime(\"2021-01-01T00:00:00Z\")]))",
},
{
assert: func(g *GraphTraversalSource) *GraphTraversal {
return g.V().Has("date",
P.Between(time.Date(2021, 1, 1, 0, 0, 0, 0, time.UTC), time.Date(2021, 2, 22,
0, 0, 0, 0, time.UTC)))
},
- equals: "g.V().has('date',between(new
Date(121,1,1,0,0,0),new Date(121,2,22,0,0,0)))",
+ equals:
"g.V().has(\"date\",between(datetime(\"2021-01-01T00:00:00Z\"),datetime(\"2021-02-22T00:00:00Z\")))",
},
{
assert: func(g *GraphTraversalSource) *GraphTraversal {
return g.V().Has("date",
P.Inside(time.Date(2021, 1, 1, 0, 0, 0, 0, time.UTC), time.Date(2021, 2, 22, 0,
0, 0, 0, time.UTC)))
},
- equals: "g.V().has('date',inside(new
Date(121,1,1,0,0,0),new Date(121,2,22,0,0,0)))",
+ equals:
"g.V().has(\"date\",inside(datetime(\"2021-01-01T00:00:00Z\"),datetime(\"2021-02-22T00:00:00Z\")))",
},
{
assert: func(g *GraphTraversalSource) *GraphTraversal {
return g.V().Has("date", P.Gt(time.Date(2021,
1, 1, 9, 30, 0, 0, time.UTC)))
},
- equals: "g.V().has('date',gt(new
Date(121,1,1,9,30,0)))",
+ equals:
"g.V().has(\"date\",gt(datetime(\"2021-01-01T09:30:00Z\")))",
},
{
assert: func(g *GraphTraversalSource) *GraphTraversal {
return g.V().Has("runways", P.Between(3, 5))
},
- equals: "g.V().has('runways',between(3,5))",
+ equals: "g.V().has(\"runways\",between(3,5))",
},
{
assert: func(g *GraphTraversalSource) *GraphTraversal {
return g.V().Has("runways", P.Inside(3, 5))
},
- equals: "g.V().has('runways',inside(3,5))",
+ equals: "g.V().has(\"runways\",inside(3,5))",
},
{
assert: func(g *GraphTraversalSource) *GraphTraversal {
return g.V("44").OutE().ElementMap()
},
- equals: "g.V('44').outE().elementMap()",
+ equals: "g.V(\"44\").outE().elementMap()",
},
{
assert: func(g *GraphTraversalSource) *GraphTraversal {
return g.V("44").ValueMap().By(T__.Unfold())
},
- equals: "g.V('44').valueMap().by(unfold())",
+ equals: "g.V(\"44\").valueMap().by(__.unfold())",
},
{
assert: func(g *GraphTraversalSource) *GraphTraversal {
return
g.V("44").ValueMap().With(WithOptions.Tokens, WithOptions.Labels)
},
- equals:
"g.V('44').valueMap().with(WithOptions.tokens,WithOptions.labels)",
+ equals:
"g.V(\"44\").valueMap().with(\"~tinkerpop.valueMap.tokens\",2)",
Review Comment:
I'd much rather see WithOptions encoded in token form (`WithOptions.tokens`,
`WithOptions.labels`) instead of their underlying value form
(`"~tinkerpop.valueMap.tokens"`, `2`), however I see that this may present a
challenge given the current implementation in some languages. I agree this
should be saved for a future revisit.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]