dgraph增删改查
1. 添加一条
{
"set": [{
"uid": "_:id",
"name": "Alice",
"age": 13,
"dgraph.type": "User",
}]
}
2. 添加多条
{
"set": [
{
"uid": "_:id",
"name": "Alice",
"age": 13,
"dgraph.type": "User",
},
{
"uid": "_:id",
"name": "Bob",
"age": 13,
"dgraph.type": "User",
},
]
}
3. 查询
{
users(func: type(User)) @filter(eq(username, "alice")) {
uid
expand(_all_)
}
}
4. 删除
{
"delete": [
"uid": "0x1345"
]
}
5. 分页
{
ids as users(func: type(User), first:10, offset:0) {
uid
expand(_all_)
}
metrics(func:uid(ids)) {
count: count(uid)
}
}
转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 wind.kaisa@gmail.com