2

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
    }
4

1 回答 1

0

1) res 必须是 []struct 类型

2)不要使用“;” 在查询结束时。stmt :=MATCH (u:User) WHERE u.userId = {userid} delete u RETURN count(u)

于 2017-01-04T07:28:08.983 回答