pagination#
- class litestar.pagination.AbstractAsyncClassicPaginator#
-
Base paginator class for async classic pagination.
Implement this class to return paginated result sets using the classic pagination scheme.
- abstract async get_total(page_size: int) int #
Return the total number of records.
- Parameters:
page_size¶ – Maximal number of records to return.
- Returns:
An integer.
- class litestar.pagination.AbstractAsyncCursorPaginator#
-
Base paginator class for async cursor pagination.
Implement this class to return paginated result sets using the cursor pagination scheme.
- abstract async get_items(cursor: C | None, results_per_page: int) tuple[list[T], Optional[C]] #
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] #
Return a paginated result set given an optional cursor (unique ID) and a maximal number of results to return.
- class litestar.pagination.AbstractAsyncOffsetPaginator#
-
Base paginator class for limit / offset pagination.
Implement this class to return paginated result sets using the limit / offset pagination scheme.
- class litestar.pagination.AbstractSyncClassicPaginator#
-
Base paginator class for sync classic pagination.
Implement this class to return paginated result sets using the classic pagination scheme.
- abstract get_total(page_size: int) int #
Return the total number of records.
- Parameters:
page_size¶ – Maximal number of records to return.
- Returns:
An integer.
- class litestar.pagination.AbstractSyncCursorPaginator#
-
Base paginator class for sync cursor pagination.
Implement this class to return paginated result sets using the cursor pagination scheme.
- abstract get_items(cursor: C | None, results_per_page: int) tuple[list[T], Optional[C]] #
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] #
Return a paginated result set given an optional cursor (unique ID) and a maximal number of results to return.
- class litestar.pagination.AbstractSyncOffsetPaginator#
-
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#
Bases:
Generic
[T
]Container for data returned using limit/offset pagination.
- class litestar.pagination.CursorPagination#
Bases:
Generic
[C
,T
]Container for data returned using cursor pagination.