factos/factos_sqlight/simulate

SQLite-backed execution of application subscriptions during simulation.

Accepted simulated event batches run strong subscriptions in a BEGIN IMMEDIATE transaction. The event history remains in memory; only application-owned projection writes are committed to SQLite.

Values

pub fn new(
  model: factos.Model(command, state, event, domain_error),
  connection connection: sqlight.Connection,
  subscriptions subscriptions: List(
    factos.Subscription(
      sqlight.Connection,
      factos.Recorded(event),
      subscription_error,
    ),
  ),
) -> simulate.Simulation(
  event,
  command,
  state,
  domain_error,
  subscription_error,
  sqlight.Error,
)

Create a simulation whose accepted events update SQLite subscriptions.

Each simulate.given or successful simulate.dispatch batch opens and closes its own transaction. Subscription or transaction failure leaves the batch out of simulated history and is accumulated by simulate.assert_errors.

Search Document