postgresql - "variable invitationId of type Int! is used in position expecting Int_comparison_exp"

标签 postgresql graphql hasura

我尝试在 hasura 平台上进行查询,但出现以下错误。 我得到了同样的解决方案。这就是我分享的原因。 变量:

     {
          "invaId": 791
       }


查询:


    mutation UpdateQuery($status:String!,$invaId:Int!) {
      update_inva(_set: {status: $status},where:{id:$invaId}){
         affected_rows
      }
    }


Output:
{
  "errors": [
    {
      "extensions": {
        "path": "$.selectionSet.update_inva.args.where.id",
        "code": "validation-failed"
      },
      "message": "variable invaId of type Int! is used in position expecting Int_comparison_exp"
    }
  ]
}

I faced this error after passing the variable of type Int!.

最佳答案

问题在查询中。

看where子句

哪里:{id:$invitationId})

where 子句也需要比较类型,例如。 _eq

这正是我所缺少的。

所以,我按如下方式更新了查询,一切都运行得很好

查询:

mutation UpdateQuery($status:String!,$invaId:Int!) {
  update_inva(_set: {status: $status},where:{id:{_eq:$invaId}}){
    affected_rows
  }
}

关于postgresql - "variable invitationId of type Int! is used in position expecting Int_comparison_exp",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62302319/

相关文章:

mongodb - 看不到关系 - Loopback 4 + MongoDB + openapi-to-graphql

javascript - Graphql - 有没有办法同时插入两个表,但第二个表依赖于从第一个表的返回?

postgresql - 使用 Hasura 在 postgresql 中搜索 jsonb 字段

docker - 如何在一个 Istio 服务网格中托管多个应用程序?

java - Hibernate:两个外键作为 id

spring - Bluemix Docker Container部署结果为 “No route to host”

postgresql - 为什么 Postgres 拒绝在某些设置中使用复合索引?

sql - 在Unnest中订购

reactjs - 如何导入 GraphQL 查询?

node.js - 使用 Mongoose 和 GraphQL 保存实体后数据为空