Skip to content

Commit 986782c

Browse files
authored
docs: add imports in some examples (#22)
* docs: add imports in some examples * 💅
1 parent 3b93a98 commit 986782c

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

docs/pagination.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
heading_level: false
1616
show_source: false
1717

18-
### `SQLAlchemy` example
18+
## `SQLAlchemy` example
1919

2020
``` py title="example.py" hl_lines="25 26 27"
2121
from fastapi import FastAPI
@@ -64,7 +64,7 @@ async def list_heros(paginate: Paginate, age:int | None = None):
6464
return await paginate(stmt)
6565
```
6666

67-
### `SQLModel` example
67+
## `SQLModel` example
6868

6969
```python
7070
from fastapi import FastAPI

src/fastsqla.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,10 @@ async def new_session() -> AsyncGenerator[AsyncSession, None]:
230230
231231
Example:
232232
233-
``` py title="example.py" hl_lines="3"
233+
``` py title="example.py" hl_lines="6"
234+
from fastsqla import Item, Session
235+
...
236+
234237
@app.get("/heros/{hero_id}", response_model=Item[HeroItem])
235238
async def get_items(
236239
session: Session, # (1)!
@@ -252,6 +255,10 @@ async def get_items(
252255
the session instead:
253256
254257
```python
258+
from fastsqla import Item, Session
259+
...
260+
261+
255262
@app.post("/heros", response_model=Item[HeroItem])
256263
async def create_item(session: Session, new_hero: HeroBase):
257264
hero = Hero(**new_hero.model_dump())

0 commit comments

Comments
 (0)