Expand description
Page-number pagination over HTTP: PageParams reads and checks
?page=N&per_page=M, and Page is the response body.
Page is built from the ORM’s orm::Page
(QuerySet::paginate is unchanged: one COUNT and one fetch), so
total and items come from two statements. Without a transaction
that pins a snapshot, rows written between them can make total and
the items disagree, and an unordered queryset can return a row on two
pages or on none; order by a unique key for stable pages.
CursorParams and CursorPage page by cursor instead (?after= or
?before= and ?limit=): one statement, no total, and rows that exist
for the whole iteration are returned exactly once.
Structs§
- Cursor
Page - One page of
Tas a response body, with the cursors to its neighbours and no total. - Cursor
Params ?after=TOKENor?before=TOKEN, and?limit=Nfrom 1 toMAX,DEFAULTwhen absent.- Page
- One page of
Tas a response body. - Page
Params ?page=N&per_page=M: a 1-based page and a page size from 1 toMAX,DEFAULTwhen absent.
Type Aliases§
- Fetched
- The result of
PageParams::fetch.