Qx event store: event-sourced aggregates with Postgres-backed event log and snapshots
Project description
qx-eventstore
Event-sourced aggregates for the Qx framework. Aggregates are persisted as an immutable event stream in Postgres, with optional periodic snapshots for efficient replay.
Usage
from dataclasses import dataclass, field
from qx.eventstore import EventSourcedAggregate, EventStore, include_eventstore_tables
class MoneyDeposited(DomainEvent):
event_name = "account.money_deposited"
amount: int
@dataclass
class Account(EventSourcedAggregate[str]):
balance: int = field(default=0)
def deposit(self, amount: int) -> None:
self.record_event(MoneyDeposited(amount=amount))
def apply_moneydeposited(self, ev: MoneyDeposited) -> None:
self.balance += ev.amount
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
qx_eventstore-1.1.0.tar.gz
(7.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qx_eventstore-1.1.0.tar.gz.
File metadata
- Download URL: qx_eventstore-1.1.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7be5d3585586837d89068476eb3e134f0668dea27953512992a7a59096ec782f
|
|
| MD5 |
817b2549c118d6fbf877a03560ea9965
|
|
| BLAKE2b-256 |
c16f4281eff6b567818fe6aff61452242ff16b0c8f9a3897e24f4ed279abe77d
|
File details
Details for the file qx_eventstore-1.1.0-py3-none-any.whl.
File metadata
- Download URL: qx_eventstore-1.1.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2056156fcb8833e69920e7add2044b4a9508971f0f7fc86a631ba57f6c29d312
|
|
| MD5 |
1ff861d652ef20500d73c0b6677f4a45
|
|
| BLAKE2b-256 |
53600522a4c2eaa76c0b13a2b1a84197bf3685085b77c7d9b94bed977455f127
|