go-gremlin/gremlin

rebindings map

Opened this issue · 3 comments

I have found that some gremlin server implementations, DSE Graph in particular, require aliases to be provided. This is discussed here, but there is no indication of what the key/value pair look like.

Could you update the documentation to explain how this should be handled?

I'm not up to date with the developments in Tinkerpop at the moment. Thanks for the heads up. Will look into it.

While not about your package, this thread has some details and a solution for a different package:
https://groups.google.com/forum/#!topic/gremlin-users/sjlzWPBJZ0k

Well, go-gremlin fully exposes the request object to you (including its request args which include the rebindings map) before it's submitted to the server. It's very easy to customise however you want. Query returns that object and Exec is called on it so here is how you can go about it:-

// Create a new request
req := gremlin.Query(`g.V()`)
// Populate the rebindings map
req.Args.Rebindings = gremlin.Bind{
  "g": "demo.g",
}
// Process the request
data, err := req.Exec()

Note that Query is merely a factory for creating a request. It's totally optional. You can create your own request by hand if you want and call Exec on it.