service_man/api/infrastructure/persistence/uow.py

15 lines
379 B
Python
Raw Normal View History

2024-03-31 04:18:41 +03:00
from sqlalchemy.ext.asyncio import AsyncSession
from api.application.abstractions import UnitOfWork
class SqlAlchemyUnitOfWork(UnitOfWork):
def __init__(self, session: AsyncSession) -> None:
self.session = session
async def commit(self) -> None:
await self.session.commit()
async def rollback(self) -> None:
await self.session.rollback()