pip_services3_commons.data.PagingParams module

pip_services3_commons.data.PagingParams

Data paging parameters 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.PagingParams.PagingParams(skip: int = None, take: int = None, total: bool = False)

Bases: object

Data transfer object to pass paging parameters for queries.

The page is defined by two parameters: - the skip() parameter defines number of items to skip. - the take() parameter sets how many items to return in a page. - additionally, 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:

filter = FilterParams.fromTuples("type", "Type1")
paging = PagingParams(0, 100)

myDataClient.get_data_by_filter(filter, paging)
static from_json(value: Any)pip_services3_commons.data.PagingParams.PagingParams
static from_map(map: Any)pip_services3_commons.data.PagingParams.PagingParams

Creates a new PagingParams and sets it parameters from the specified map

Parameters

map – a AnyValueMap or StringValueMap to initialize this PagingParams

Returns

a newly created PagingParams.

static from_tuples(*tuples: Any)pip_services3_commons.data.PagingParams.PagingParams

Creates a new PagingParams from a list of key-args pairs called tuples.

Parameters

tuples – a list of values where odd elements are keys and the following even elements are values

Returns

a newly created PagingParams.

static from_value(value: Any)pip_services3_commons.data.PagingParams.PagingParams

Converts specified args into PagingParams.

Parameters

value – args to be converted

Returns

a newly created PagingParams.

get_skip(min_skip: int)int

Gets the number of items to skip.

Parameters

min_skip – the minimum number of items to skip.

Returns

the number of items to skip.

get_take(max_take: int)int

Gets the number of items to return in a page.

Parameters

max_take – the maximum number of items to return.

Returns

the number of items to return.

has_total()
to_json() → Dict[str, Any]