15 lines
379 B
Python
15 lines
379 B
Python
|
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()
|