Skip to main content

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


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-0.2.0.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qx_eventstore-0.2.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file qx_eventstore-0.2.0.tar.gz.

File metadata

  • Download URL: qx_eventstore-0.2.0.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for qx_eventstore-0.2.0.tar.gz
Algorithm Hash digest
SHA256 21749cc77ab2c7b751f756df25ba2fe12796c972e3c6b212525199338a3c95af
MD5 6673ec3894915a6239b47bb6d3172ee3
BLAKE2b-256 a1ead4ac039c67aa565b04a292d85ce76dc417e3c24b576c3e8d8cae70723000

See more details on using hashes here.

File details

Details for the file qx_eventstore-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: qx_eventstore-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for qx_eventstore-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c2b6354a8178a672d7f142f7f644a8b42835f71a493556964adfbe67e7711ac
MD5 f84372460cc6348d3b9a7eb4827ae781
BLAKE2b-256 c4ded68a7b3299dc3a2a71987ed8c39a7fc4a050f3edc5e83ff45c6c9649b7d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page