How to implement pagination when using amazon Dynamo DB in rails

前端 未结 4 1760
抹茶落季
抹茶落季 2020-12-17 10:05

I want to use amazon Dynamo DB with rails.But I have not found a way to implement pagination.

I will use AWS::Record::HashModel as ORM.

This ORM

4条回答
  •  难免孤独
    2020-12-17 10:21

    You can provide 'page-size' in you query to set the result set size. The response of DynamoDB contains 'LastEvaluatedKey' which will indicate the last key as per the page size. If response does't contain 'LastEvaluatedKey' it means there are no results left to fetch. Use the 'LastEvaluatedKey' as 'ExclusiveStartKey' while fetching next time.

    I hope this helps.

    DynamoDB Pagination

提交回复
热议问题