pip_services3_commons.data.DataPage module

pip_services3_commons.data.DataPage

Data page implementation

copyright

Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details.

license

MIT, see LICENSE for more details.

class pip_services3_commons.data.DataPage.DataPage(data: List[Any] = (), total: int = None)

Bases: object

Data transfer object that is used to pass results of paginated queries. It contains items of retrieved page and optional total number of items.

Most often this object type is used to send responses to paginated queries. Pagination parameters are defined by PagingParams object. The skip() parameter in the PagingParams there means how many items to skip. The takes() parameter sets number of items to return in the page. And the optional total() parameter tells to return total number of items in the query.

Remember: not all implementations support the total() parameter because its generation may lead to severe performance implications.

Example:

my_data_client.get_data_by_filter("123",
                                FilterParams.from_tuples("completed", true),
                                PagingParams(0, 100, true),
                                page)
for item in page.get_data():
    print (item)
static from_json(value)
to_json()