amazon-dynamodb - 使用带有解析器映射模板的 AppSync 在 DynamoDB 中存储数组(已编辑)
问题描述
我在使用 AppSync 在 PutItem 上的 DynamoDB 中存储数组时遇到了一些问题,这让我抓狂:P
问题是我从 GraphQl 传递的数组在我运行时消失了$util.dynamodb.toMapValuesJson
。我究竟做错了什么?
我真的坚持这一点,非常感谢我能得到的任何帮助!
这是模板:
#set($failing_list = [ "foo", 123, { "bar" : "baz" } ])
{
"version" : "2017-02-28",
"operation" : "PutItem",
"key": {
"userId": { "S": "$ctx.args.input.email" },
"createdAt": { "N": "$util.time.nowEpochMilliSeconds()" }
},
"data" : {
"test": $util.dynamodb.toMapValuesJson({
"working_list": [ "foo", 123, { "bar" : "baz" } ],
"failing_list": $failing_list
})
}
}
这是结果:
{
version: '2017-02-28',
operation: 'PutItem',
key: {
userId: { S: 'xxxxxxxxxxxx' },
createdAt: { N: '1531521284789' }
},
data: {
test: {
working_list: {
L: [ { S: 'foo' }, { N: '123' }, { M: { bar: { S: 'baz' } } } ]
},
failing_list: {
M: { L: { L: [ { M: { map: { M: {} } } }, { M: { map: { M: {} } } }, { M: { map: { M: {} } } } ] } }
}
}
}
}
解决方案
推荐阅读
- laravel - 在空路由模型绑定 Laravel 7 上调用成员函数 where()
- artifactory - 如何在 JFrog CLI 搜索和下载命令中使用 --archive-entries 选项
- reactjs - React 不会理解烧瓶发送给它的图像
- asp.net-core - 如何为 serverAndClient 使用响应缓存
- javascript - Nuxt.js 无法使用 auth 模块启动
- javascript - lodsh 过滤器不适用于对象数组
- javascript - 视频聊天反应应用程序:未捕获(承诺中)类型错误:无法读取 null 的属性“附加”
- vue.js - Vuejs:如何实现响应式禁用日期选择器
- azure - Azure 部署问题:未处理的异常:无法加载文件或程序集“Microsoft.Azure.DocumentDB.Core”
- ios - eval 的脚本卡在 react native 版本 0.63.1 (iOS)