pypaginate.domain.protocols
Backend contracts (ports) for the hexagonal architecture.
Each protocol defines the minimal interface a backend must implement.
Protocols are generic over query type Q and item type T
for full type safety in backend implementations.
Classes
Async backend for cursor/keyset-based pagination. |
|
Translates filter specs to backend query conditions. |
|
Async backend for offset-based pagination. |
|
Translates search specs to backend query conditions. |
|
Translates sort specs to backend query ordering. |
|
Sync backend for offset-based pagination. |
Module Contents
- class pypaginate.domain.protocols.CursorBackend
Bases:
Protocol[T]Async backend for cursor/keyset-based pagination.
- class pypaginate.domain.protocols.FilterBackend
Bases:
ProtocolTranslates filter specs to backend query conditions.
- apply_filters(query: object, filters: collections.abc.Sequence[pypaginate.domain.specs.FilterSpec]) object
Apply filter specifications to a query.
- class pypaginate.domain.protocols.PaginationBackend
Bases:
Protocol[T]Async backend for offset-based pagination.
- class pypaginate.domain.protocols.SearchBackend
Bases:
ProtocolTranslates search specs to backend query conditions.
- static apply_search(query: object, spec: pypaginate.domain.specs.SearchSpec) object
Apply search specification to a query.
- class pypaginate.domain.protocols.SortBackend
Bases:
ProtocolTranslates sort specs to backend query ordering.
- static apply_sorting(query: object, sorting: collections.abc.Sequence[pypaginate.domain.specs.SortSpec]) object
Apply sort specifications to a query.