thy1016/mooncmd/store does not have a README file
pub(all) suberror EventStoreError {
DuplicateVersion(Int)
StorageError(String)
SerializationError(String)
}pub(all) suberror SnapshotError {
StorageError(String)
SerializationError(String)
}pub(all) struct EventStore[AggregateId, E] {
append : (EventStore[AggregateId, E], AggregateId, Array[EventMessage[AggregateId, E]]) -> Unit raise EventStoreError
load : (EventStore[AggregateId, E], AggregateId, Int) -> Array[EventMessage[AggregateId, E]] raise EventStoreError
current_version : (EventStore[AggregateId, E], AggregateId) -> Int raise EventStoreError
}pub struct SQLiteEventStore[E] {
conn : Connection
serialize : (E) -> Bytes
deserialize : (Bytes) -> E raise
get_type_name : (E) -> String
}fn[E] SQLiteEventStore::append(self : SQLiteEventStore[E], aggregate_id : String, events : Array[EventMessage[String, E]]) -> Unit raisefn[E] SQLiteEventStore::current_version(self : SQLiteEventStore[E], aggregate_id : String) -> Int raisefn[E] SQLiteEventStore::load(self : SQLiteEventStore[E], aggregate_id : String, after_version : Int) -> Array[EventMessage[String, E]] raisefn[E] SQLiteEventStore::new(db_path : String, serialize : (E) -> Bytes, deserialize : (Bytes) -> E raise, get_type_name : (E) -> String) -> SQLiteEventStore[E] raisepub struct Snapshot[AggregateId, S] {
aggregate_id : AggregateId
state : S
version : Int
timestamp : Int64
}pub(all) struct SnapshotStore[AggregateId, S] {
save : (AggregateId, S, Int, Int64) -> Unit raise SnapshotError
load : (AggregateId) -> (S, Int)? raise SnapshotError
}Install
Download zipCommand-side event sourcing kernel for MoonBit: pure command handlers, auto-wrapped EventMessage metadata (correlation/causation), optimistic concurrency with duplicate-version rejection, SQLite event store, projections and snapshots.