graviti.paging.offset#

Paging list offset related class.

Module Contents#

Classes#

Offsets

The offsets manager of the paging list.

class graviti.paging.offset.Offsets(total_count, limit)[source]#

The offsets manager of the paging list.

Parameters
  • total_count (int) – The total count of the elements in the paging list.

  • limit (int) – The size of each page.

update(self, start, stop, lengths)[source]#

Update the offsets when setting or deleting paging list items.

Parameters
  • start (int) – The start index.

  • stop (int) – The stop index.

  • lengths (Iterable[int]) – The length of the set values.

Return type

None

get_coordinate(self, index)[source]#

Get the page coordinate of the elements.

Parameters

index (int) – The index of the element in paging list.

Returns

The page number and the index of the page.

Return type

Tuple[int, int]

extend(self, lengths)[source]#

Update the offsets when extending the paging list.

Parameters

lengths (Iterable[int]) – The lengths of the extended pages.

Return type

None

copy(self)[source]#

Return a copy of the Offsets.

Returns

A copy of the Offsets.

Parameters

self (_O) –

Return type

_O