Skip to content

Instantly share code, notes, and snippets.

@n5i
Created March 28, 2017 17:22
Show Gist options
  • Save n5i/7c471d02dfd1086ebb132707b3fb3e26 to your computer and use it in GitHub Desktop.
Save n5i/7c471d02dfd1086ebb132707b3fb3e26 to your computer and use it in GitHub Desktop.
Receiving nested response from Neo4j to Golang.
package main
import(
"github.com/jmcvetta/neoism"
"fmt"
)
func main(){
// Connect to the neo4j database with the address provided
db, _ := neoism.Connect("http://neo4j:xxx@localhost:7474/db/data")
type Report struct {
Name string
Subreports []Report
}
res := make([]Report, 0)
cq := neoism.CypherQuery{
Statement: `CALL test.nested()`,
Result: &res,
}
err = db.Cypher(&cq)
if err != nil {
fmt.Printf("There was an error on request %v\n", err)
}
fmt.Printf("Result: %#v\n", res)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment