REFACTOR - Database logic
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
"""
|
||||
Shared Database Infrastructure
|
||||
Provides consistent database patterns across all microservices
|
||||
"""
|
||||
|
||||
from .base import DatabaseManager, Base, create_database_manager
|
||||
from .repository import BaseRepository
|
||||
from .unit_of_work import UnitOfWork, ServiceUnitOfWork, RepositoryRegistry
|
||||
from .transactions import (
|
||||
transactional,
|
||||
unit_of_work_transactional,
|
||||
managed_transaction,
|
||||
managed_unit_of_work,
|
||||
TransactionManager,
|
||||
run_in_transaction,
|
||||
run_with_unit_of_work
|
||||
)
|
||||
from .exceptions import (
|
||||
DatabaseError,
|
||||
ConnectionError,
|
||||
RecordNotFoundError,
|
||||
DuplicateRecordError,
|
||||
ConstraintViolationError,
|
||||
TransactionError,
|
||||
ValidationError,
|
||||
MigrationError,
|
||||
HealthCheckError
|
||||
)
|
||||
from .utils import DatabaseUtils, QueryLogger
|
||||
|
||||
__all__ = [
|
||||
# Core components
|
||||
"DatabaseManager",
|
||||
"Base",
|
||||
"create_database_manager",
|
||||
|
||||
# Repository pattern
|
||||
"BaseRepository",
|
||||
|
||||
# Unit of Work pattern
|
||||
"UnitOfWork",
|
||||
"ServiceUnitOfWork",
|
||||
"RepositoryRegistry",
|
||||
|
||||
# Transaction management
|
||||
"transactional",
|
||||
"unit_of_work_transactional",
|
||||
"managed_transaction",
|
||||
"managed_unit_of_work",
|
||||
"TransactionManager",
|
||||
"run_in_transaction",
|
||||
"run_with_unit_of_work",
|
||||
|
||||
# Exceptions
|
||||
"DatabaseError",
|
||||
"ConnectionError",
|
||||
"RecordNotFoundError",
|
||||
"DuplicateRecordError",
|
||||
"ConstraintViolationError",
|
||||
"TransactionError",
|
||||
"ValidationError",
|
||||
"MigrationError",
|
||||
"HealthCheckError",
|
||||
|
||||
# Utilities
|
||||
"DatabaseUtils",
|
||||
"QueryLogger"
|
||||
]
|
||||
Reference in New Issue
Block a user