是否可以使用api.NQuadfrom从给定节点中删除与谓词匹配的所有边github.com/dgraph-io/dgo/protos/api?
我正在努力达到相当于 delete {0x1234 <test.likes> * }
func TestDeleteQuad(t *testing.T) {
subject := "0x01"
ctx := context.TODO()
d, err := grpc.Dial(testEndpoint, grpc.WithInsecure())
if err != nil {
panic(err)
}
client := dgo.NewDgraphClient(api.NewDgraphClient(d))
txn := client.NewTxn()
defer txn.Discard(ctx)
if _, err := txn.Mutate(ctx, &api.Mutation{Del: []*api.NQuad{
&api.NQuad{
Subject: subject,
Predicate: "test.likes",
ObjectId: "*",
ObjectValue: nil,
},
}}); nil != err {
panic(err)
}
err = txn.Commit(ctx)
assert.NoError(t, err)
}
我尝试将其"*" "" x.Star用作ObjectId,但这些解决方案均无效
相关分类