AshDynamo.DataLayer.Query.Paginator (ash_dynamo v0.6.1)

Copy Markdown View Source

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.

Functions

fetch(table, mode, base_opts, limit \\ nil)

Fetches items from DynamoDB, handling pagination via LastEvaluatedKey/ExclusiveStartKey.

Returns a merged response map with the same shape as a single ExAws response: %{"Items" => [...], "Count" => N, "ScannedCount" => N}.