Expand description
§SQLite Read Model Store
Production-grade implementation of ReadModelStore backed by an
r2d2-pooled SQLite connection. Each projection table follows the
framework’s standard projection shape: (id TEXT PK, version BIGINT, data TEXT). The data column holds the full row as JSON, so this store
can serve any projector without compile-time knowledge of the
domain-specific columns.
§Idempotency
upsert translates to
INSERT INTO {table} (id, version, data) VALUES (?, ?, ?)
ON CONFLICT(id) DO UPDATE
SET version = excluded.version, data = excluded.data
WHERE {table}.version < excluded.versionThat gate makes replay-from-zero deterministic and tolerates at-least-once delivery: applying an older event twice, or out-of-order, never regresses state.
§Queries
find_by uses json_extract(data, '$.{field}')
to reach into the blob. Columns commonly queried (e.g. email) get
expression indexes in the migration that creates the table.
§Boundaries
The store does not create tables — DDL lives in migrations/. That
keeps the production write path away from connection-time mutations and
lets diesel migration run control schema evolution.
Structs§
- Sqlite
Read Model Store - SQLite implementation of
ReadModelStore.