Sign up for Hasura Newsletter
Loading...

todoの一括削除 - mutation

ここでは、完了した既存のtodoをGraphQL Mutationsを使って一括削除する方法を学びます。

todosへのmutationを行うためのgraphql queryを定義します。

mutation clearCompleted {
delete_todos(where: {is_completed: {_eq: true}, is_public: {_eq: false}}) {
affected_rows
}
}

また、variablesに値を渡す必要があります。

アプリケーションデータベースに対してGraphiQLを使ってこのmutationを 試して 、どのような応答が得られるかを確認します。

このgraphql mutationをReactアプリに組み込みましょう。

Did you find this page helpful?
Start with GraphQL on Hasura for Free
  • ArrowBuild apps and APIs 10x faster
  • ArrowBuilt-in authorization and caching
  • Arrow8x more performant than hand-rolled APIs
Promo
footer illustration
Brand logo
© 2024 Hasura Inc. All rights reserved
Github
Titter
Discord
Facebook
Instagram
Youtube
Linkedin