Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/go/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
关于新主义golang的cypher查询结果_Go_Neo4j_Cypher_Neoism - Fatal编程技术网

关于新主义golang的cypher查询结果

关于新主义golang的cypher查询结果,go,neo4j,cypher,neoism,Go,Neo4j,Cypher,Neoism,我有一个函数来删除“User”节点并返回count deleted节点,但它总是返回-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} r

我有一个函数来删除“User”节点并返回count deleted节点,但它总是返回-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
    }
1) res必须是[]结构类型

2) 不要在查询结束时使用“;”。
stmt:=
MATCH(u:User)其中u.userId={userId}删除u返回计数(u)

如果我们使用
[]结构{quantity int}
,我们必须
返回res[0]。quantity
,对吗?是的!!还有一个示例代码。。试着理解