Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site maintenance this Wednesday, February 1. Disruptions expected as we migrate the forums.

Golang - converting maps to strong type

Graph Buddy

Just wondering if anyone has some experience converting from a map[string]interface{} to a declared type?

i.e. in Go if I have:

type Person struct {
    name string
    age int64

if I run this query:

MATCH (p:Person) RETURN p { .name, .age } AS person

is there a better way to get a go person then something along the lines of:

Person{record["name"].(string), record["age"].(int64)}
  • Go

Hi, I'm aware this is a question from a long time ago and the driver has changed a lot since, but there is still today no built-in support to hydrate structs from raw maps in the driver.
A solution like GitHub - mindstand/gogm: Golang Object Graph Mapper for Neo4j might be something of interest.

Nodes 2022
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online