fsprojects / FSharp.AWS.DynamoDB

F# wrapper API for AWS DynamoDB
MIT License
58 stars 18 forks source link

Pagination support #27

Closed samritchie closed 2 years ago

samritchie commented 4 years ago

Placeholder issue/design discussion for Scan & Query pagination support

  1. Paginated queries/scans will take an ?exclusiveStartKey : TableKey parameter and return a PaginationResult<'TRecord> defined as { Records : 'TRecord[]; LastEvaluatedKey : TableKey option }
  2. (Tentatively) these will be added as new methods QueryPaginated etc, although I’m tempted to convert the existing methods to return paginated results as the default and add QueryAll to perform unbounded queries, even though this is a breaking change.
  3. New convenience accessors on the PaginationResult - eg member x.GetLastEvaluatedHashKey<'HashKey>() : 'HashKey option to enable serialisation of key values for client-side pagination. For a query this will typically only be the range key as the hash key should already be known. For a scan two key values may be required.

Unfortunately I’ve just discovered GSI queries also require the table key attributes in addition to the index. I’ll be able to get this to work if the returned LastEvaluatedKey is used as an opaque parameter for the next query, but manually constructing an ExclusiveStartKey from client requests is going to be painful.

purkhusid commented 3 years ago

@samritchie Is there any work going on regarding this? If you have a work in progress branch somewhere I could take a look at it and possibly continue with it.