Sign up for Hasura Newsletter
Loading...

批量删除待办事项 - 变更

在本教程的这一部分中,您将学习如何使用 GraphQL 变更批量删除所有现有的已完成的待办事项。

让我们定义一个graphql 查询以对待办事项进行变更。

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

你还需要传入变量的值。

在 GraphiQL 中针对应用程序数据库尝试此变更,以查看响应是什么样的。

现在让我们将这个graphql 变更集成到我们的反应应用程序中。

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