Metadata-Version: 2.1
Name: fastapi-lowlevel-pagination
Version: 0.0.1
Summary: A fastapi lowlevel pagination system
Home-page: https://github.com/LooLzzz/fastapi-lowlevel-pagination
Author: LooLzzz
Author-email: noaml12@hotmail.com
Project-URL: Bug Tracker, https://github.com/LooLzzz/fastapi-lowlevel-pagination/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE

# 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

```py
import fast_pagination as pg
```

### Routes

```py
@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

```py
async def db_query_func(page_request: PageRequest, **extra_kwargs) -> dict:
    ...  # db query logic goes here

    return {
        'results': results,
        'total_items': total_items
    }
```
