#events #store #stream #deal #event-sourcing #aspect #uuid

event_store

Crate to deal with every aspect of an eventstore

2 releases

0.1.1 Sep 11, 2021
0.1.0 Jul 20, 2020

#1825 in Encoding


Used in chekov

MIT license

82KB
2K SLoC

EventStore

The EventStore will allow you to deal with every aspects of the event sourcing part of Chekov.

Appending an event

Events are appended by using the fluent API exposed at the root level of the event_store crate:

use event_store::prelude::*;
#

let stream_uuid = Uuid::new_v4().to_string();
let my_event = MyEvent { account_id: Uuid::new_v4() };

event_store::append()
  .event(&my_event)?
  .to(&stream_uuid)?
  .execute(event_store)
  .await;

Reading from stream

A Stream can be read with the fluent API exposed at the root level of the event_store crate:

use event_store::prelude::*;
#

let stream_uuid = Uuid::new_v4().to_string();

event_store::read()
  .stream(&stream_uuid)?
  .from(ReadVersion::Origin)
  .limit(10)
  .execute(event_store)
  .await;

Dependencies

~15–29MB
~439K SLoC