【发布时间】:2020-11-18 14:23:50
【问题描述】:
我是一个传统的 GraphQL 程序员新手,我似乎找不到关于我认为的基础知识的文档,也就是操纵变量。注意:我通过应用 GraphiQL 将 GraphQL 与 Shopify(Admin API) 一起使用,以便影响语法和功能。
这是一段低 (& 损坏的) 代码,其中我对同一代码块进行了两次迭代
- 试图添加两个变量
- 关于列表中的总和项目。此行中的具体代码是猜测。
如果有人对 GraphQL 站点之外的示例代码或 API 文档的来源有建议,我一直在搜索,但没有找到任何解决此类功能的问题。
query fiveorTenOrders($n: Int = 5,$m: list =[5,5], $boo: Boolean = true) {
FiveOrds: orders(first: $n) {
edges @include(if: $boo) {
node {
...ordrecs
}
}
}
#<<<HERE and as basic arithmetic>>>
TenOrds: orders(first: ($n+$n) {
edges @skip(if: $boo) {
node {
...ordrecs
#<<<OR HERE ...as a sum of list>>>
TenOrds: orders(first: $m:SUM {
edges @skip(if: $boo) {
node {
...ordrecs
}
}
}
}
fragment ordrecs on Order {
id
name
createdAt
shippingAddress {
id
city
provinceCode
zip
}
}
【问题讨论】: