- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
所有文档和教程通常都会显示如下所示的简单突变示例:
extend type Mutation {
edit(postId: String): String
}
edit
方法必须在所有实体中都是唯一的,对我来说这似乎不是一种非常健壮的写东西方式。我想描述与我们描述查询类似的突变,如下所示:
type PostMutation {
edit(postId: String): String
}
extend type Mutation {
post: PostMutation
}
最佳答案
这是可能的,但通常不是一个好主意,因为:
它打破了规范。 来自 section 6.3.1 :
Because the resolution of fields other than top‐level mutation fields must always be side effect‐free and idempotent, the execution order must not affect the result, and hence the server has the freedom to execute the field entries in whatever order it deems optimal.
user
字段,然后是
posts
场,最后是
comments
每个帖子的字段。在每个“级别”,字段的内容取决于父字段解析为的值。这通常不是突变的情况。
firstName
和
lastName
的
User
类型同时解析。但是,如果您的操作类型是
mutation
,根字段将一次解析一个。所以在这样的查询中:
mutation SomeOperationName {
createUser
editUser
deleteUser
}
mutation
时。 ,所以这三个字段将并行解析:
mutation SomeOperationName {
user {
create
edit
delete
}
}
makeExecutableSchema
时的做法。 ,这就是 Apollo 在幕后使用的内容:
const resolvers = {
Mutation: {
post: () => ({}), // return an empty object,
},
PostMutation: {
edit: () => editPost(),
},
// Other types here
}
PostMutation
作为对象类型,因此 GraphQL 期望该字段返回一个对象。如果您省略
post
的解析器,它将返回 null,这意味着不会触发返回类型 (
PostMutation
) 的解析器。这也意味着,我们也可以这样写:
mutation {
post
}
关于graphql - 突变方法是否需要在顶层?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54459947/
我正在开发一个需要多个窗口的程序,第一个出现的是登录窗口,我使用了 Toplevel 小部件以使其他窗口成为其子窗口,但这段代码一直显示两个窗口而不是一个。 from Tkinter import F
我不知道一般如何实现这一点,但为了清楚起见,我会特别询问一个实例: Sexplib 对我来说看起来很有趣。我想玩弄它。我已经下载了它,安装得很好(反正我很确定)等等。我想在顶层使用“with sexp
我在 makefile 中设置一个变量,如下所示: SOMEVAR = foo 此 makefile 稍后包含一些其他 makefile,在其中进行实际的程序构建: include generic/M
from tkinter import* import tkinter as tk def topLevel(): top=Toplevel() top.title("Listbox
我想查看乘法函数 (*) 的类型,因此我将其输入 OCaml 顶层。 # (*) 然而,顶层回应: (*);; 1: this is the start of a comment. 然后消耗我输入的任
我喜欢Try Ocaml的顶层行为:;; 在我按下 Enter 时隐式添加,并且我能够使用 Shift-Enter 进行多行编辑。 是否有可能在标准顶层或 utop 中获得相同的功能? 最佳答案 目前
我想知道,在 Ocaml 中,是否有部分输入信息。对于无法编译的程序,可以通过顶层/编译器的某些现有功能来绘制吗?让我解释。 在 Ocaml 中,众所周知,可以通过 -annot 文件检索推断类型。但
当我将分层 SVG 文件加载到 Illustrator 中时,所有图层都按其应有的方式工作,但它们始终位于新图层下;我没有指定“第 1 层”。 如何创建一个 SVG,使我的顶层最终也成为 Illust
我遇到了让我的 TreeView 填充已创建的顶层窗口的挑战,已尝试 fill=“x”和 fill=“both”,但没有得到结果。有任何建议这样做。 from tkinter import ttk i
标签在 div 中
我有以下布局: target target not target 我的问题是,如何定位所有顶级 标签(参见 target )使用 .fin
大家好,我有一个 div.mapFullscreenContainer #mapFullscreenContainer { position:fixed; top:0; lef
我有一个以编程方式创建的标签栏 Controller ,名为 TPastJourneyTabbar。当我单击 TableView 并调用 didSelectRowAtIndexPath: 时,我的选项
我是一名优秀的程序员,十分优秀!