Created
July 20, 2018 03:33
-
-
Save sdawood/0edba0770dd8ea080204b1ea7cec8fd9 to your computer and use it in GitHub Desktop.
Async Wrapper for DocumentClient.query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function query(table, {keyConditionExpression, expressionAttributeValues} = {}, options = {}, params = {}) { | |
| const docClient = new AWS.DynamoDB.DocumentClient({...options}); | |
| const requiredParams = { | |
| TableName: table, | |
| KeyConditionExpression: keyConditionExpression, | |
| ExpressionAttributeValues: expressionAttributeValues, | |
| ReturnConsumedCapacity: 'TOTAL' | |
| }; | |
| return docClient.query({...requiredParams, ...params}).promise(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment