Coverage for pyodmongo/models/paginate.py: 100%
6 statements
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-16 15:08 +0000
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-16 15:08 +0000
1from pydantic import BaseModel
4class ResponsePaginate(BaseModel):
5 """
6 A model for representing paginated responses specifically tailored for use with
7 PyODMongo in applications dealing with large datasets that require efficient data
8 retrieval. This class encapsulates essential pagination details along with the
9 actual documents (docs) that are being paginated, as retrieved from a MongoDB
10 database via PyODMongo queries.
12 Attributes:
13 current_page (int): The index of the current page being viewed.
14 page_quantity (int): The total number of pages available based on the current
15 pagination settings and the total dataset size.
16 docs_quantity (int): The number of documents present in the current page.
17 docs (list): A list containing the documents of the current page. The specific
18 type and structure of these documents will depend on the application's
19 data model.
21 This model can be used to standardize the response format for paginated data across
22 different parts of an application, ensuring consistency and ease of integration
23 with frontend paging mechanisms.
24 """
26 current_page: int
27 page_quantity: int
28 docs_quantity: int
29 docs: list