pagination¶
- class litestar.pagination.AbstractAsyncClassicPaginator[source]¶
-
Base paginator class for async classic pagination.
Implement this class to return paginated result sets using the classic pagination scheme.
- abstractmethod async get_total(page_size: int) int[source]¶
Return the total number of records.
- Parameters:
page_size¶ – Maximal number of records to return.
- Returns:
An integer.
- class litestar.pagination.AbstractAsyncCursorPaginator[source]¶
-
Base paginator class for async cursor pagination.
Implement this class to return paginated result sets using the cursor pagination scheme.
- abstractmethod async get_items(cursor: C | None, results_per_page: int) tuple[list[T], C | None][source]¶
Return a list of items of the size ‘results_per_page’ following the given cursor, if any,
- Parameters:
- Returns:
A tuple containing the result set and a new cursor that marks the last record retrieved. The new cursor can be used to ask for the ‘next_cursor’ batch of results.
- async __call__(cursor: C | None, results_per_page: int) CursorPagination[C, T][source]¶
Return a paginated result set given an optional cursor (unique ID) and a maximal number of results to return.
- class litestar.pagination.AbstractAsyncOffsetPaginator[source]¶
-
Base paginator class for limit / offset pagination.
Implement this class to return paginated result sets using the limit / offset pagination scheme.
- abstractmethod async get_total() int[source]¶
Return the total number of records.
- Returns:
An integer.
- class litestar.pagination.AbstractSyncClassicPaginator[source]¶
-
Base paginator class for sync classic pagination.
Implement this class to return paginated result sets using the classic pagination scheme.
- abstractmethod get_total(page_size: int) int[source]¶
Return the total number of records.
- Parameters:
page_size¶ – Maximal number of records to return.
- Returns:
An integer.
- class litestar.pagination.AbstractSyncCursorPaginator[source]¶
-
Base paginator class for sync cursor pagination.
Implement this class to return paginated result sets using the cursor pagination scheme.
- abstractmethod get_items(cursor: C | None, results_per_page: int) tuple[list[T], C | None][source]¶
Return a list of items of the size ‘results_per_page’ following the given cursor, if any,
- Parameters:
- Returns:
A tuple containing the result set and a new cursor that marks the last record retrieved. The new cursor can be used to ask for the ‘next_cursor’ batch of results.
- __call__(cursor: C | None, results_per_page: int) CursorPagination[C, T][source]¶
Return a paginated result set given an optional cursor (unique ID) and a maximal number of results to return.
- class litestar.pagination.AbstractSyncOffsetPaginator[source]¶
-
Base paginator class for limit / offset pagination.
Implement this class to return paginated result sets using the limit / offset pagination scheme.
- class litestar.pagination.ClassicPagination[source]¶
Bases:
Generic[T]Container for data returned using limit/offset pagination.
- class litestar.pagination.CursorPagination[source]¶
Bases:
Generic[C,T]Container for data returned using cursor pagination.