pypaginate.engine.paginator

Sync and async paginators for offset-based pagination.

Each paginator owns the pipeline: count -> clamp -> fetch -> OffsetPage.

Classes

AsyncPaginator

Async orchestrator: count -> clamp -> fetch -> OffsetPage.

Paginator

Sync orchestrator: count -> clamp -> fetch -> OffsetPage.

Module Contents

class pypaginate.engine.paginator.AsyncPaginator(backend: pypaginate.domain.protocols.PaginationBackend[ItemT], *, overflow: pypaginate.domain.enums.OverflowStrategy = OverflowStrategy.EMPTY)

Bases: Generic[ItemT]

Async orchestrator: count -> clamp -> fetch -> OffsetPage.

async paginate(query: object, params: pypaginate.domain.params.OffsetParams) Any

Execute the async pagination pipeline.

Parameters:
  • query – Backend-specific query object.

  • params – Offset pagination parameters.

Returns:

OffsetPage (or FastOffsetPage if msgspec installed).

class pypaginate.engine.paginator.Paginator(backend: pypaginate.domain.protocols.SyncPaginationBackend[ItemT], *, overflow: pypaginate.domain.enums.OverflowStrategy = OverflowStrategy.EMPTY)

Bases: Generic[ItemT]

Sync orchestrator: count -> clamp -> fetch -> OffsetPage.

paginate(query: object, params: pypaginate.domain.params.OffsetParams) Any

Execute the sync pagination pipeline.

Parameters:
  • query – Backend-specific query or data source.

  • params – Offset pagination parameters.

Returns:

OffsetPage (or FastOffsetPage if msgspec installed).