api.NQuad
是否可以使用from从给定节点中删除与谓词匹配的所有边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
as ObjectId 但这些解决方案都不起作用