英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论