Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null Pointer Exception #93

Open
akshaykumar12527 opened this issue Mar 9, 2016 · 2 comments
Open

Null Pointer Exception #93

akshaykumar12527 opened this issue Mar 9, 2016 · 2 comments
Labels

Comments

@akshaykumar12527
Copy link

websites, _ := DB.NodesByLabel("Website")
for _, website := range websites {
stmt := MATCH (webpage:Webpage)-[]->(website:Website{website:{website}}) RETURN webpage;
address, _ := website.Property("address")
params := neoism.Props{"website": address}

    // query results
    res := []struct {
        Webpage neoism.Node `json:"webpage"`
    }{}

    // construct query
    cq := neoism.CypherQuery{
        Statement:  stmt,
        Parameters: params,
        Result:     &res,
    }
    // execute query
    err := DB.Cypher(&cq)
    fmt.Println(err, res[0].Webpage.Id())  
}

Here err is nil but res[0].Webpage is typeof Node and still have not Id() method and Data present in this object.

@jmcvetta jmcvetta added the bug label Mar 9, 2016
@jmcvetta
Copy link
Owner

jmcvetta commented Mar 9, 2016

Thanks for reporting this issue.

Unfortunately the info supplied in the issue is not sufficient to reproduce the bug, as it presumes that data is already present in the database.

Please write a failing test case for this bug so I can easily reproduce it. Then I will try to find time to look into it. If you are able to resolve the bug yourself, and Pull Request will be happily accepted.

@akshaykumar12527
Copy link
Author

It turns out that you have to initialize the Db property of Webpage returned by CypherQuery in res struct manually before you can call methods like Id() which is present in neoism.Node. Of course, you can do that once you are aware it has to be done, but it feels very awkward. Is there a more intuitive way of handling this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants