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.
- abstractmethod async get_total(page_size: int) int[源代码]¶
Return the total number of records.
- 参数:
page_size¶ -- Maximal number of records to return.
- 返回:
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.
- abstractmethod async get_items(cursor: C | None, results_per_page: int) tuple[list[T], C | None][源代码]¶
Return a list of items of the size 'results_per_page' following the given cursor, if any,
- 参数:
- 返回:
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.
- abstractmethod get_total(page_size: int) int[源代码]¶
Return the total number of records.
- 参数:
page_size¶ -- Maximal number of records to return.
- 返回:
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.
- abstractmethod get_items(cursor: C | None, results_per_page: int) tuple[list[T], C | None][源代码]¶
Return a list of items of the size 'results_per_page' following the given cursor, if any,
- 参数:
- 返回:
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[源代码]¶
基类:
Generic[T]Container for data returned using limit/offset pagination.
- class litestar.pagination.CursorPagination[源代码]¶
基类:
Generic[C,T]Container for data returned using cursor pagination.