17 lines
343 B
Python
17 lines
343 B
Python
from typing import Annotated, AsyncGenerator
|
|
|
|
from fastapi import Depends
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from src.db.database import async_session_maker
|
|
|
|
|
|
async def get_db() -> AsyncGenerator[AsyncSession, None]:
|
|
async with async_session_maker as db:
|
|
yield db
|
|
|
|
|
|
DBDep = Annotated[AsyncSession, Depends(get_db)]
|
|
|
|
|