我尝试在 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/