johnnadratowski / golang-neo4j-bolt-driver

Golang Bolt driver for Neo4j
MIT License
213 stars 72 forks source link

Cannot read from rows.NextNeo() - graph.Node not exported #52

Closed anne-markis closed 6 years ago

anne-markis commented 6 years ago

I'm probably doing something obviously wrong here, so I'd appreciate any push in the right direction.

I see in the examples something like

data, _, err = rows.NextNeo()
fmt.Printf("FIELDS: %d %f\n", data[0].(int64), data[1].(float64))

However, when I do this, I get a Panic: interface conversion error. And when I check the type -

fmt.Printf("Type: ", reflext.typeOf(data[0]))

I get graph.Node.

Since it is not exported, I'm unable to do a type assertion d[0].(graph.Node) as I get this compile issue: "cannot refer to unexported name golangNeo4jBoltDriver.graph".

Is there a better way to read from rows.NextNext() that I'm missing?

umsu2 commented 6 years ago

copy and paste your import statement for the graph

anne-markis commented 6 years ago
import (
    "fmt"
    "io"
    "reflect"

    bolt "github.com/johnnadratowski/golang-neo4j-bolt-driver"
)

Note that d[0].(bolt.graph.Node) is also not exported.

umsu2 commented 6 years ago

import neo4jgraph "github..../golang-neo4j-bolt-driver/structures/graph"

then type assert to neo4jgraph.Node this is not an issue for the library.

anne-markis commented 6 years ago

Doh. That did it. Thanks!