-
-
Save charmander/fb1bc626ca60021a8795dec09f4b7846 to your computer and use it in GitHub Desktop.
This file contains 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
const scanNext = lastEvaluatedKey => | |
scan(lastEvaluatedKey) | |
.tap(data => { | |
console.log(++counter, data.Count, data.LastEvaluatedKey); | |
}) | |
.then(data => | |
data.LastEvaluatedKey ? | |
scanNext(data.LastEvaluatedKey) : | |
Promise.resolve() | |
); | |
const somePromise = scanNext(); | |
const scan = (lastEvaluatedKey) => { | |
return dynamodb.scan({ TableName: process.env.TABLE, Limit: 20, ExclusiveStartKey: lastEvaluatedKey }).promise(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment