sync
parent
2ca7787dcb
commit
12d61e01e1
|
@ -0,0 +1,15 @@
|
|||
from typing import Protocol
|
||||
|
||||
|
||||
class TransactionContextManager(Protocol):
|
||||
async def __aenter__(self):
|
||||
raise NotImplementedError
|
||||
|
||||
async def __aexit__(self, exc_type, exc_val, exc_tb):
|
||||
raise NotImplementedError
|
||||
|
||||
async def commit(self):
|
||||
raise NotImplementedError
|
||||
|
||||
async def rollback(self):
|
||||
raise NotImplementedError
|
|
@ -2,10 +2,11 @@ from types import TracebackType
|
|||
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from api.application.abstractions.transaction import TransactionContextManager
|
||||
from api.infrastructure.persistence.error import TransactionContextManagerError
|
||||
|
||||
|
||||
class SqlalchemyTransactionContextManager:
|
||||
class SqlalchemyTransactionContextManager(TransactionContextManager):
|
||||
def __init__(self, session: AsyncSession):
|
||||
self._session = session
|
||||
|
||||
|
|
Loading…
Reference in New Issue