pypaginate.adapters.memory
In-memory backends for pagination, filtering, sorting, and search.
Submodules
Classes
Sync pagination backend for in-memory sequences. |
|
Filter backend for in-memory sequences (native |
|
Search backend for in-memory sequences. |
|
Sort backend for in-memory sequences (native |
Package Contents
- class pypaginate.adapters.memory.MemoryBackend
Bases:
Generic[ItemT]Sync pagination backend for in-memory sequences.
Counts via
len()and fetches via slicing. SatisfiesSyncPaginationBackend[ItemT]protocol.
- class pypaginate.adapters.memory.MemoryFilterBackend
Filter backend for in-memory sequences (native
_core).- static apply_filters(query: object, filters: collections.abc.Sequence[pypaginate.domain.specs.FilterSpec]) object
Apply flat filter specs (combined with AND) to a sequence.
- Parameters:
query – A Python sequence of items.
filters – Filter specifications to apply.
- Returns:
Filtered list of items matching all specs.
- class pypaginate.adapters.memory.MemorySearchBackend
Search backend for in-memory sequences.
- static apply_search(query: object, spec: pypaginate.domain.specs.SearchSpec) object
Apply a search spec to a sequence.
- Parameters:
query – A Python sequence of items.
spec – Search specification with query and fields.
- Returns:
Filtered list of items matching the search (original order).
- class pypaginate.adapters.memory.MemorySortBackend
Sort backend for in-memory sequences (native
_core).- static apply_sorting(query: object, sorting: collections.abc.Sequence[pypaginate.domain.specs.SortSpec]) object
Apply sort specs to a sequence.
- Parameters:
query – A Python sequence of items.
sorting – Sort specifications (applied in priority order).
- Returns:
New sorted list of items.