Handles DynamoDB pagination via LastEvaluatedKey and ExclusiveStartKey.
DynamoDB returns at most 1MB of data per request. When more items are available,
the response includes a LastEvaluatedKey that must be passed as ExclusiveStartKey
in the next request. This module encapsulates that loop, accumulating pages until
the requested limit is reached or no more data is available.
When a FilterExpression is present, Limit is not passed to DynamoDB. This is
because DynamoDB applies Limit before FilterExpression, so a small limit would
constrain the evaluation window and cause excessive pagination when few items match
the filter. Instead, DynamoDB evaluates its natural 1MB page and the Paginator
controls the stopping logic based on accumulated post-filter item count.
When no FilterExpression is present, every evaluated item is returned, so Limit
is passed directly to DynamoDB to avoid over-reading.
Summary
Functions
Fetches items from DynamoDB, handling pagination via LastEvaluatedKey/ExclusiveStartKey.