neoeinstein / modyne

An opinionated Rust library for interacting with AWS DynamoDB single-table designs.
Apache License 2.0
53 stars 1 forks source link

Feature request: Support for pagination #135

Open happylinks opened 1 day ago

happylinks commented 1 day ago

Hey again!

Is there a way to support pagination? (https://docs.rs/aws-sdk-dynamodb/latest/aws_sdk_dynamodb/operation/query/paginator/struct.QueryPaginator.html) I don't think I have direct access to the dynamodb query struct when using modyne's query, so thinking this will have to be built into Modyne?

Thanks!

neoeinstein commented 1 day ago

Modyne doesn't use the QueryPaginator as linked, but there are examples of how to paginate through a query. It may be possible to wrap this in an iterator, but that is not directly provided by Modyne.

The example here doesn't do any internal looping, instead expecting a new call with a token for accessing the next page, but should be relatively easy to convert to consume multiple pages at once if desired: https://github.com/neoeinstein/modyne/blob/main/dynamodb-book/ch19-ecomm/src/lib.rs#L79-L99