factos/factos_pog/simulate

PostgreSQL-backed execution of application subscriptions during simulation.

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

Values

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

Create a simulation whose accepted events update PostgreSQL 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