【发布时间】:2018-04-01 18:40:12
【问题描述】:
我找到了this package。一般来说,它很不错。但它似乎缺乏对Projection Expressions 的支持。您在 node/typescript 中选择 dynamodb 的工具是什么?
我不喜欢 here 列出的数据映射器,因为它们倾向于包装表数据,或者作为项目被放弃。
【问题讨论】:
我找到了this package。一般来说,它很不错。但它似乎缺乏对Projection Expressions 的支持。您在 node/typescript 中选择 dynamodb 的工具是什么?
我不喜欢 here 列出的数据映射器,因为它们倾向于包装表数据,或者作为项目被放弃。
【问题讨论】:
如果 typescript 是一个选项,我们使用https://github.com/shiftcode/dynamo-easy。其中也不支持投影表达式,但底层参数始终可以是accessed and manipulated,因此添加一些不支持的功能很容易。
import { DynamoStore } from '@shiftcoders/dynamo-easy'
const queryRequest = new DynamoStore(PersonModel)
.query()
.wherePartitionKey('2018-01')
.whereSortKey().beginsWith('a')
.limit(1)
const queryParams = queryRequest.params
queryParams.ProjectionExpression = 'projectionExpression'
// also add expression attribute names if required
queryParams.ExpressionAttributeNames = {'#someExpressionAttributeName': 'someExpressionAttributeName'}
// you can also use new DynamoDB().query(queryParams), but we just use the preconfigured wrapped client
queryRequest.dynamoDBWrapper.makeRequest('query', queryParams)
.then(r => console.log('first found item with projection expression:', r))
全面披露:我是这个库的作者之一
【讨论】:
我们使用 dynogels,它一直保持到今天。
【讨论】:
如果您需要 GUI 来构建查询,请尝试使用我构建的“DynamoDB Visual Query Builder”:https://dynobase.dev/dynamodb-query-builder/
【讨论】: