Hi! I'm using
gremlin-go to interact with my graph and was wondering if there is an easier way to get the ID of a new node.
Right now I'm creating the node like so:
promise := g.AddV("my_node_type").Property("name", "foobar").Iterate()
err := <-promise
if err != nil {
return err
}
But to get the ID I need to read the new node back from the graph:
result, err := g.V().HasLabel("my_node_type").Has("name", "foobar").ToList()
if err != nil {
return err
}
if len(result) == 0 {
return fmt.Errorf("no results")
}
id := result[0].GetString()
Seems like in other languages the SDK will return the ID of the new node after its created. Is there a better way than what I'm doing in Golang?