68 lines
1.5 KiB
Python
68 lines
1.5 KiB
Python
"""
|
|
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"
|
|
] |