diff --git a/docs/pagination.md b/docs/pagination.md index ec47648..c4d4885 100644 --- a/docs/pagination.md +++ b/docs/pagination.md @@ -15,7 +15,7 @@ heading_level: false show_source: false -### `SQLAlchemy` example +## `SQLAlchemy` example ``` py title="example.py" hl_lines="25 26 27" from fastapi import FastAPI @@ -64,7 +64,7 @@ async def list_heros(paginate: Paginate, age:int | None = None): return await paginate(stmt) ``` -### `SQLModel` example +## `SQLModel` example ```python from fastapi import FastAPI diff --git a/src/fastsqla.py b/src/fastsqla.py index c0c260d..7795620 100644 --- a/src/fastsqla.py +++ b/src/fastsqla.py @@ -230,7 +230,10 @@ async def new_session() -> AsyncGenerator[AsyncSession, None]: Example: -``` py title="example.py" hl_lines="3" +``` py title="example.py" hl_lines="6" +from fastsqla import Item, Session +... + @app.get("/heros/{hero_id}", response_model=Item[HeroItem]) async def get_items( session: Session, # (1)! @@ -252,6 +255,10 @@ async def get_items( the session instead: ```python +from fastsqla import Item, Session +... + + @app.post("/heros", response_model=Item[HeroItem]) async def create_item(session: Session, new_hero: HeroBase): hero = Hero(**new_hero.model_dump())