Graphql AWS Appsync:如何写入增量为1的变异更新

Graphql AWS Appsync:如何写入增量为1的变异更新,graphql,aws-appsync,Graphql,Aws Appsync,我在dynamo中成功地编写了一个变异查询并更新了值,如下所示: mutation update { updateTodo(input: id: “xxxxxxxxx” completed: true }) { id title completed } } 但在表ToDo中,我有另一个字段quantity(Int),我想增加1(quantity++)。如何编写一个变异查询来实现它 对于您可以添加到DDB UpdateExp

我在dynamo中成功地编写了一个变异查询并更新了值,如下所示:

mutation update {
    updateTodo(input:
        id: “xxxxxxxxx”
        completed: true
    }) {
        id title completed
    }
}
但在表ToDo中,我有另一个字段
quantity
(Int),我想增加1(quantity++)。如何编写一个变异查询来实现它


对于您可以添加到DDB UpdateExpression中的类似“SET quantity=quantity+:val”的突变,我们非常感谢您的AppSync解析器中的任何建议,其中:val是您的增量大小(例如1)

这里有更多示例: