sopherapps / pydantic-redis

A simple Declarative ORM for Redis using pydantic Models
https://sopherapps.github.io/pydantic-redis
MIT License
39 stars 14 forks source link

Add Pagination on `select` all #20

Closed Tinitto closed 1 year ago

Tinitto commented 1 year ago

For performance reasons when querying all items for a given model, we need to allow a user to specify a form of pagination

In order to leverage familiarity with the fantastic pydantic_aioredis, we can use skip and limit i.e.

Book.select(limit=10, skip=100)

Note: limit and skip should be ignored when ids are specified so as to avoid unexpected results. i.e.

assert Book.select(ids=["Jane Eyre"], limit=0, skip=100) == Book.select(ids=["Jane Eyre"])