A fastapi lowlevel pagination system
Project description
Fast Pagination
Description
A lowlevel, fast and easy to use package for creating and managing your own pagination system while FastAPI.
Keeping the pagination system simple was the main goal of this package.
You provide your own database querying logic and the pagination system will handle the rest.
Example
Imports
import fast_pagination as pg
Routes
@router.get(..., response_model=pg.generate_response_schema(SomeModel))
async def some_route(
pagination: pg.Pagination[SomeModel] = Depends(
pg.get_pagination_dependency(offset_kwargs={...},
limit_kwargs={...},
filter_kwargs={...})
),
... # additional route dependencies goes here
):
return await pagination.paginate(
func=db_query_func,
... # func kwargs goes here
)
Services
async def db_query_func(page_request: PageRequest, **extra_kwargs) -> dict:
... # db query logic goes here
return {
'results': results,
'total_items': total_items
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for fastapi-lowlevel-pagination-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c75af340dfebe091b49e3a5ffb23ad42a16ab8da160f4bdcd0616f48e2973de |
|
MD5 | 543b95a79a7c641dbb64b6ade4115c21 |
|
BLAKE2b-256 | 46c6d26d1a87cfec1887575e4e47fa598b18630e8bd35a99c24fa49ae93b0562 |
Close
Hashes for fastapi_lowlevel_pagination-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c0a7e7559ff49f3141ea9b1f41dcf9703077940afdeb8533a6986bf43b470b7 |
|
MD5 | 7d0f0e3a628b289c55ac8e9276c7ddd9 |
|
BLAKE2b-256 | bec6f1ff0b29cd515f82dc81f1054369650eb40785060a6f6b4b21a5e6fc1a7f |