graphql - 如何在 graphQL 中使用 where 参数?
问题描述
我有这个正在运行的查询:
{
ArticleGalleriesCollection(limit: 2, locale: "en", where: {articleTitle: "Hello"}) {
items {
articleTitle
articleGalleryType {
type
width
height
}
articleAssetsElementsCollection(limit: 100) {
items {
fileName
url
contentType
width
height
size
}
}
}
}
}
我想更新我的 where 参数,告诉 graphQL 只过滤 ArticleGalleriesCollection 中具有 type="standard" 的 articleGalleryType 的文章
我应该如何更新我的查询?
Schema : ArticleGalleriesCollection 中的每个项目都有一个 1:1 的 articleGalleryType 和一个 type 属性
解决方案
graphql 可以询问的内容直接取决于模式、服务器(解析器)
如果您的 api 不支持过滤,articleGalleryType
那么构造无效查询是没有意义的。
过滤没有通用标准(准备好,内置) - 这是您的服务器的责任(业务逻辑)。
推荐阅读
- r - R - 将圆圈添加到现有的时间序列图中
- c++ - 反转字符串的c ++函数不起作用
- javascript - 匹配 javascript 中的正则表达式
- android - 无法在 30 秒内启动模拟器
- r - 您如何在 R 中运行编译器平均因果效应 (CACE) 分析?
- laravel - 通过 Laravel 中的数据透视表获取数据
- javascript - 如何到达 json 嵌套的最后一层并动态格式化输出?
- javascript - react/javascript - 类型错误:无法读取 null 的属性“classList”
- python - Python dexplot 改变 x 值的顺序
- javascript - 需要使用 HTML Canvas 将鼠标事件转换为移动设备的触摸事件