Search⌘ K
AI Features

Aggregate Repositories and Event Stores

Explore how to manage aggregates in event-driven Golang applications using aggregate repositories and event stores. Learn the Load and Save methods, efficient serialization and deserialization, and how a type registry helps handle concrete types safely during event sourcing.

Because we will be dealing with aggregates that, regardless of their structure, will be decomposed down to a stream of events, we can create and reuse a single repository and store.

AggregateRepository and related interfaces

Let us look at AggregateRepository and the interfaces involved in the following figure:

AggregateRepository and related interfaces
AggregateRepository and related interfaces

The Load() and Save() methods are the only methods we will use with event-sourced aggregates and their event streams. There are occasions when we would need to delete ...