spakky-data¶
Repository, Transaction 추상화 — 데이터 접근 계층
Persistency¶
spakky.data.persistency.repository
¶
EntityNotFoundError
¶
VersionConflictError
¶
Bases: AbstractSpakkyDomainError
Raised when optimistic locking detects a version conflict during save.
IGenericRepository
¶
Bases: ABC, Generic[AggregateRootT, AggregateIdT_contra]
Synchronous generic repository interface for aggregate persistence.
get(aggregate_id)
abstractmethod
¶
get_or_none(aggregate_id)
abstractmethod
¶
contains(aggregate_id)
abstractmethod
¶
range(aggregate_ids)
abstractmethod
¶
save(aggregate)
abstractmethod
¶
save_all(aggregates)
abstractmethod
¶
Persist multiple aggregates and return the saved instances.
delete(aggregate)
abstractmethod
¶
delete_all(aggregates)
abstractmethod
¶
Delete multiple aggregates and return the deleted instances.
IAsyncGenericRepository
¶
Bases: ABC, Generic[AggregateRootT, AggregateIdT_contra]
Asynchronous generic repository interface for aggregate persistence.
get(aggregate_id)
abstractmethod
async
¶
get_or_none(aggregate_id)
abstractmethod
async
¶
contains(aggregate_id)
abstractmethod
async
¶
range(aggregate_ids)
abstractmethod
async
¶
save(aggregate)
abstractmethod
async
¶
save_all(aggregates)
abstractmethod
async
¶
Persist multiple aggregates and return the saved instances.
delete(aggregate)
abstractmethod
async
¶
delete_all(aggregates)
abstractmethod
async
¶
Delete multiple aggregates and return the deleted instances.
options: show_root_heading: false
spakky.data.persistency.transaction
¶
AbstractTransaction(autocommit=True)
¶
Bases: IDisposable, ABC
Abstract base for synchronous transaction context managers.
Initialize the transaction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
autocommit
|
bool
|
Whether to auto-commit on successful exit. |
True
|
Source code in core/spakky-data/src/spakky/data/persistency/transaction.py
AbstractAsyncTransaction(autocommit=True)
¶
Bases: IAsyncDisposable, ABC
Abstract base for asynchronous transaction context managers.
Initialize the async transaction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
autocommit
|
bool
|
Whether to auto-commit on successful exit. |
True
|
Source code in core/spakky-data/src/spakky/data/persistency/transaction.py
options: show_root_heading: false
spakky.data.persistency.error
¶
AbstractSpakkyPersistencyError
¶
Bases: AbstractSpakkyFrameworkError, ABC
Base error for persistency layer operations.
options: show_root_heading: false
External Proxy¶
spakky.data.external.proxy
¶
ProxyModel
¶
Bases: IEquatable, Generic[ProxyIdT_contra]
Immutable read-only projection model identified by an equatable ID.
__eq__(other)
¶
IGenericProxy
¶
IAsyncGenericProxy
¶
options: show_root_heading: false
spakky.data.external.error
¶
AbstractSpakkyExternalError
¶
Bases: AbstractSpakkyFrameworkError, ABC
Base error for external proxy operations.
options: show_root_heading: false
Aspects¶
spakky.data.aspects.transactional
¶
Transactional()
dataclass
¶
Bases: FunctionAnnotation
Annotation for marking methods as transactional.
Methods decorated with @Transactional() will be executed within a transaction context, ensuring atomicity of operations.
AsyncTransactionalAspect(transaction)
¶
Bases: IAsyncAspect
Aspect for managing transactions in async methods.
Intercepts async methods decorated with @Transactional and ensures that they are executed within a transaction context.
Source code in core/spakky-data/src/spakky/data/aspects/transactional.py
TransactionalAspect(transaction)
¶
Bases: IAspect
Aspect for managing transactions in sync methods.
Intercepts sync methods decorated with @Transactional and ensures that they are executed within a transaction context.
Source code in core/spakky-data/src/spakky/data/aspects/transactional.py
transactional(func)
¶
Decorator for marking methods as transactional.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
Callable[P, R]
|
The function to decorate. |
required |
Returns: The decorated function with transactional annotation.
Source code in core/spakky-data/src/spakky/data/aspects/transactional.py
options: show_root_heading: false