中继突变被定义为“对数据存储进行写入,然后获取任何已更改字段的操作” . 伐木等事情怎么样?我没有找到突变与查询的正式定义,就像在REST POST与GET与PUT协议中找到的一样 . 我是否正确当需要修改和返回数据时会使用突变但是如果我只需要更新某些内容那么标准查询就可以了?在某些情况下,我可能会获取数据但更新不需要返回的内容 .
中继突变被定义为“对数据存储进行写入,然后获取任何已更改字段的操作” . 伐木等事情怎么样?
如果我理解你对 logging 的正确理解,你想在你的服务器上记录一些东西,但你没有在客户端更新任何东西 . 如果要使用GraphQL和Relay进行日志记录,则应将此日志记录操作建模为变异 . 查询实际上是只读操作 .
如果 logging 是一个拼写错误而你实际上意味着 login ,那么在Relay和GraphQL领域中有很多关于身份验证的答案 . 查看以下SO和博客文章:
Relayjs Graphql user authentication
javascript - Authentication and privileges on Relay/GraphQL
api - How do I structure authenticated queries with GraphQL?
node.js - What is a good pattern for implementing access control in a GraphQL server?
graphql - Authentication and Access Control with Relay
node.js - How to check permissions and other conditions in GraphQL query?
relayjs - How to tell the user to log in with relay?
A guide to authentication in GraphQL — Building Apollo — Medium
Auth in GraphQL — Part 2 — Building Apollo — Medium
我没有找到突变与查询的正式定义,就像在REST POST与GET与PUT协议中找到的一样 .
来自GraphQL draft specification:
There are two types of operations that GraphQL models: * query – a read‐only fetch. * mutation – a write followed by a fetch.
我是否正确,当希望修改和返回数据时会使用突变,但如果我只需要更新某些内容,那么标准查询就可以了?
不,那是不对的 . 变异是您应该用于对数据进行任何类型修改的操作 . 如果你不在fat query中包含任何内容 . 截至目前,GraphQL没有任何特定的更新操作类型,之后无需获取数据 .
1 回答
如果我理解你对 logging 的正确理解,你想在你的服务器上记录一些东西,但你没有在客户端更新任何东西 . 如果要使用GraphQL和Relay进行日志记录,则应将此日志记录操作建模为变异 . 查询实际上是只读操作 .
如果 logging 是一个拼写错误而你实际上意味着 login ,那么在Relay和GraphQL领域中有很多关于身份验证的答案 . 查看以下SO和博客文章:
Relayjs Graphql user authentication
javascript - Authentication and privileges on Relay/GraphQL
api - How do I structure authenticated queries with GraphQL?
node.js - What is a good pattern for implementing access control in a GraphQL server?
graphql - Authentication and Access Control with Relay
node.js - How to check permissions and other conditions in GraphQL query?
relayjs - How to tell the user to log in with relay?
A guide to authentication in GraphQL — Building Apollo — Medium
Auth in GraphQL — Part 2 — Building Apollo — Medium
来自GraphQL draft specification:
不,那是不对的 . 变异是您应该用于对数据进行任何类型修改的操作 . 如果你不在fat query中包含任何内容 . 截至目前,GraphQL没有任何特定的更新操作类型,之后无需获取数据 .