CountedPaginatedList

class safir.database.CountedPaginatedList(entries, next_cursor, prev_cursor, count)

Bases: PaginatedList, Generic

Paginated SQL results with pagination metadata and total count.

Holds a paginated list of any Pydantic type, complete with a count and cursors. Can hold any type of entry and any type of cursor, but implicitly requires the entry type be one that is meaningfully paginated by that type of cursor.

Parameters:

Attributes Summary

count

Total number of entries if queried without pagination.

entries

A batch of entries.

next_cursor

Cursor for the next batch of entries.

prev_cursor

Cursor for the previous batch of entries.

Attributes Documentation

count: int = <dataclasses._MISSING_TYPE object>

Total number of entries if queried without pagination.

entries: list[TypeVar(E, bound= BaseModel)] = <dataclasses._MISSING_TYPE object>

A batch of entries.

next_cursor: Optional[TypeVar(C, bound= PaginationCursor)] = <dataclasses._MISSING_TYPE object>

Cursor for the next batch of entries.

prev_cursor: Optional[TypeVar(C, bound= PaginationCursor)] = <dataclasses._MISSING_TYPE object>

Cursor for the previous batch of entries.