javascript - Graphql 变异返回值
问题描述
下面的 graphql 突变Account
在成功时返回一个类型:
@Mutation(() => Account)
async updateAccount(
@Arg('accountIdentifier', () => String) accountIdentifier: string,
@Arg('input', () => AccountUpdateInput) input: AccountUpdateInput
) {
await Account.update({ accountIdentifier }, input)
return Account.findOne({ accountIdentifier })
}
要执行此突变,可以使用以下命令:
mutation {
updateAccount(
accountIdentifier: "06760b98-9a9b-4686-961c-051d6b01581f",
input: {
name: "mark"
}) {
accountIdentifier
email
}
}
但是,使用相同的突变而不指定返回值会导致错误。我想知道是否可以执行上述突变或以下突变(未指定返回值)并且同时正确执行了突变?
mutation {
updateAccount(
accountIdentifier: "06760b98-9a9b-4686-961c-051d6b01581f",
input: {
name: "mark"
}
)
}
解决方案
推荐阅读
- liquibase - 当 changelog 包含 includeAll 而不是包含一个 xml 时的 Liquibase 执行顺序
- php - 有没有办法在“Vanilla”PHP 中创建异步代码?
- javascript - 从下拉可用选项中删除选定的选项
- python - 如何在计算共振峰频率特征时确定线性预测系数 (LPC) 中的滤波器阶数?
- python - Python 字符串为 null 但也不是 None 也不是空字符串
- python - 将模型属性添加到 Django 中的同一模型
- amazon-ec2 - AWS 保护 Cloudfront 到 ALB 到 Fargate 的通信
- flutter - 如何在if语句中更改边框颜色?
- python - 如何构造 elm2clu_dict
- regex - 使用正则表达式将字符串分成三部分