kien bui
kien bui

Reputation: 1820

result of cypher query on neoism golang

I have a function to delete "User" node and return count deleted node, but it always return -1.

func DeleteUser(userid int) (int, error) {
        stmt := `
        MATCH (u:User) WHERE u.userId = {userid} delete u RETURN count(u) ;
        `
        params := neoism.Props{"userid": userid}
        res := -1
        cq := neoism.CypherQuery{
            Statement:  stmt,
            Parameters: params,
            Result:     &res,
        }

        err := conn.Cypher(&cq)

        return res, err
    }

Upvotes: 2

Views: 228

Answers (1)

shivendra pratap singh
shivendra pratap singh

Reputation: 1398

1) res must be of type []struct

2) Don't use ";" at the end of query. stmt := MATCH (u:User) WHERE u.userId = {userid} delete u RETURN count(u)

Upvotes: 0

Related Questions