Showing results for 
Search instead for 
Did you mean: 

Join the community at Nodes 2022, our free virtual event on November 16 - 17.

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 - November 16 - 17, 2022.

Free NODES Training Series

October 19th -

Intro to Neo4j

October 20th -

Healthcare Analytics Using Neo4j

October 25th -

Handling Neo4j data with Apache Hop

October 26th -

Blazing Fast Graphs: Hands-on with Apache Arrow and Neo4j

November 2nd -

Graph EDA Using the Neo4j GDS Client