eventsourcing/memory_store

Types

pub opaque type MemoryStore(entity, command, event, error)

Functions

pub fn load_aggregate_entity(
  memory_store: MemoryStore(a, b, c, d),
  aggregate_id: String,
) -> a

Load a aggregate based on a aggregate_id. If the aggregate is not present, it returns an emtpy aggregate.

pub fn load_events(
  memory_store: MemoryStore(a, b, c, d),
  aggregate_id: String,
) -> List(EventEnvelop(c))

Load the currently commited events from the memory store. They are wrapped in a MemoryStoreEventEnvelop variant from the EventEnvelop type.

pub fn new(
  emtpy_entity empty_entity: a,
  handle_command_function handle: fn(a, b) -> Result(List(c), d),
  apply_function apply: fn(a, c) -> a,
) -> EventStore(MemoryStore(a, b, c, d), a, b, c, d)

Create a new memory store record.

Search Document