flip_api.utils.paging_utils
Attributes
Classes
Abstract base class for generic types. |
|
Abstract base class for generic types. |
Functions
|
Parses query string parameters for pagination details. |
|
Parses query string parameters for filter details. |
|
Calculates the total number of pages. |
Module Contents
- flip_api.utils.paging_utils.T
- class flip_api.utils.paging_utils.PagingInfo
Bases:
pydantic.BaseModel- offset: int
- page_number: int
- page_size: int
- search_str: str
- model_config
- class flip_api.utils.paging_utils.FilterInfo
Bases:
pydantic.BaseModel- owner: uuid.UUID | None
- model_config
- class flip_api.utils.paging_utils.IPagedResponse
Bases:
pydantic.BaseModel,Generic[T]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- total_rows: int
- class flip_api.utils.paging_utils.IPagedData
Bases:
pydantic.BaseModel,Generic[T]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- page: int
- page_size: int
- total_pages: int
- total_records: int
- model_config
- flip_api.utils.paging_utils.get_paging_details(query_string_parameters: dict[str, str | int | float] | None = None) PagingInfo
Parses query string parameters for pagination details.
- Parameters:
query_string_parameters – A dictionary of query parameters.
- Returns:
An object containing offset, page number, page size, and search string.
- Return type:
- flip_api.utils.paging_utils.get_filter_details(query_string_parameters: dict[str, str | uuid.UUID] | None = None) FilterInfo
Parses query string parameters for filter details.
- Parameters:
query_string_parameters – A dictionary of query parameters.
- Returns:
An object containing filter criteria (e.g., owner_id).
- Return type:
- flip_api.utils.paging_utils.get_total_pages(total_records: int, page_size_int: int) int
Calculates the total number of pages.
- Parameters:
total_records – The total number of records.
page_size_int – The number of records per page.
- Returns:
The total number of pages.
- Return type:
int