graphql - GraphQL Prisma - 在嵌套关系上使用 orderBy
问题描述
我对 GraphQL Prisma 组合相当陌生,我似乎无法毫无错误地对嵌套关系进行排序,因为唯一可用的 orderBy 字段与 ID 有关。
我在操场上的预期目标是创建一个类似于以下内容的查询:
getPosts{
connections(orderBy: "text_asc"){
id
text
}
}
解析器
getPosts(parent, args, ctx, info){
return ctx.db.query.posts({}, info)
}
数据模型
type Post {
id: ID! @id
isPublished: Boolean! @default(value: false)
title: String!
text: String!
connections: [Connection!]! @relation(name: "ClientConnect")
}
type Link {
id: ID! @id
text: String!
url: String!
}
type Connection {
id: ID! @unique @id
client: Link @relation(name: "LinkConnect")
}
解决方案
推荐阅读
- azure - 如何使用 Powershell Runbook 在 Azure Function App 中更改平台设置
- django - 需要在 pytest 工厂中覆盖 django auto_now_add
- solana - Solana - leader validator and incrementing field
- url - requests.get(URL) 返回的内容与网页上的内容不匹配,这是为什么呢?
- java - SQLiteOpenHelper.java 错误“无法解析符号”注释
- html - 如何从网页上的 jpg 图像中删除默认边框
- javascript - Laravel Blade:如何在单击添加更多时显示 textarea
- python - Django:如何创建对象字典并在模板中显示
- javascript - 从 CDN 加载 - 未捕获的 ReferenceError:particleJS 未定义
- moodle - 在 Moodle 正则表达式问题中选择字母数字短语