-
Notifications
You must be signed in to change notification settings - Fork 49
How to use result #18
Comments
Hi Martin, There really isn't any prescribed best practices for using gremgo, so you should use what works best for you. With that being said there are plans on making manipulation of results a little more intuitive instead of having chains of interfaces like in your example, because I find that a little too tedious. |
Perhaps one of you can help me, as I'm new to gremlin, Go and although I know Java, I've never used Groovy. I've also never used web sockets. I seem to be able to send a very basic parameterised script to the Groovy script engine, and I get back the resulting text. Right now I send this script to the engine:
And I'm receiving this...
My first question is, how do you tell the groovy script what to return? Does it just return the last evaluated expression? And how do you get it to return data in a format that's useful? Perhaps just a return statement that is returning a string variable? Do I need to build up a JSON document in my script that is returned, from iterating over the results? If your example code showed how to manipulate the data that is returned, say, something that has an array and a map, or collection of some sort, that would be super useful to us, as that's ultimately what we'll be working with most of the time. |
go-gremlin/gremlin is just returning the json (as []bytes), it doesn't do any json unmarshal. I find it more practical because depending on the query results I can unmarshal them to custom structs I defined myself. |
@eonpatapon I'd agree with eonpatapon. Maybe there should be an ExecBytes(), but I think an even better solution would be being able to pass in your own |
Hi - I am new to both Gremlin and to Go. Having spent the afternoon with the debugger, I now have the following code (after
g.addV()
). If this is wrong, maybe you could show the correct usage in the README file. Thanks.The text was updated successfully, but these errors were encountered: