-
How can I enable the "total" field in the result page for sqlalchemy cursor pagination? |
Beta Was this translation helpful? Give feedback.
Answered by
uriyyo
Dec 20, 2023
Replies: 1 comment 1 reply
-
Hi @holtgrewe, Currently, you need to define a custom page for this: from typing import Generic, TypeVar
from fastapi_pagination.bases import CursorRawParams
from fastapi_pagination.cursor import CursorPage, CursorParams
T = TypeVar("T")
class TotalCursorParams(CursorParams):
def to_raw_params(self) -> CursorRawParams:
params = super().to_raw_params()
params.include_total = True
return params
class TotalCursorPage(CursorPage[T], Generic[T]):
__params_type__ = TotalCursorParams |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
holtgrewe
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @holtgrewe,
Currently, you need to define a custom page for this: