如何在 .graphql 文件中编写 GraphQl Upsert 查询。

huangapple go评论73阅读模式
英文:

How to write GraphQl Upsert Query in .graphql file

问题

我可以在 Hasura UI 中执行 upsert 查询,并且在 Java 中使用 manifold 插件生成客户端类。我在将多个字段的 on_conflict 保留在 .graphql 文件中方面遇到了困难。

以下是我在 graphql 文件中使用的模式。

谢谢您宝贵的建议。

示例:
模式:
schema{ mutation: MutationRoot }

MutationRoot:
type MutationRoot { insert_indv(objects: [insert_input!]!, on_conflict: input_on_conflict) : response! }

input input_on_conflict{ constraint: input_constraint! update_columns: [input_update_column!]! }

input input_constraint{ input_pk: Int }

input input_update_column{ studentMarks: Int studentRank: Int studentJoinDate: date ..................

英文:

I am able to execute upsert query in Hasura UI and I'm using manifold plugin for client classes generation in java. I'm struggling at keeping an on_conflict with multiple fields in .graphql file.<br>
The below schema I'm using in graphql file.
<br><br> Thanks for your valuable suggestion.
<br>
ex:
schema:<br>
schema{
mutation: MutationRoot
}

<br>MutationRoot

type MutationRoot {
insert_indv(objects: [insert_input!]!, on_conflict: input_on_conflict) : response!
}

input input_on_conflict{
constraint: input_constraint!
update_columns: [input_update_column!]!
}

input input_constraint{
input_pk: Int
}

input input_update_column{
studentMarks: Int
studentRank: Int
studentJoinDate: date
..................

答案1

得分: 1

Finally, I found an answer graphql-rust/graphql-client, we need to use enums. I'm not aware that in graphQL schema file we can use enums.

英文:

Finally, I found an answer graphql-rust/graphql-client, we need to use enums. I'm not aware that in graphQL schema file we can use enums.

huangapple
  • 本文由 发表于 2020年5月5日 00:31:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/61597063.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定