cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Golang - converting maps to strong type

jsmccrumb
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
1 REPLY 1

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
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online