npm.io
3.2.0 • Published 4 years ago

dynamo-iterator

Licence
MIT
Version
3.2.0
Deps
0
Size
26 kB
Vulns
0
Weekly
0

Dynamo Iterator

A utility class to iterate Dynamo searches. When iterating, it loads results by demand, and manages batches logic.

Getting started

  • Installation npm install dynamo-iterator
  • Making a query:
import DynamoIteratorFactory from 'dynamo-iterator';

const items = DynamoIteratorFactory.query({
  TableName: 'my-table',
  KeyConditionExpression: 'id=:id',
  ExpressionAttributeValues: {'id': 'myId'}, 
});

for await (const item of items) {
  ...
}

Changelog

  • 2.0.0 Async Iterator implementation.
    • Features:
      • for await (const item of generator) { ... } form can be used
      • There is no need to precharge the generator.
    • Breaking changes:
      • Exported class is named DynamoIteratorFactory
      • DynamoIteratorFactory.preload method removed, as it is not needed.