Documentation
¶
Overview ¶
Package postgres contains implementations of go-eventually interfaces specific to PostgreSQL, such as Aggregate Repository, Event Store, etc.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunMigrations ¶
RunMigrations runs the latest migrations for the postgres integration.
Make sure to run these in the entrypoint of your application, ideally before building a postgres interface implementation.
Types ¶
type AggregateRepository ¶
type AggregateRepository[ID aggregate.ID, T aggregate.Root[ID]] struct { // contains filtered or unexported fields }
AggregateRepository implements the aggregate.Repository interface for PostgreSQL databases.
This implementation uses the "aggregates" table in the database as its main operational table. At the same time, it also writes to both "events" and "event_streams" to append the Domain events recorded by Aggregate Roots. These updates are performed within the same transaction.
func NewAggregateRepository ¶
func NewAggregateRepository[ID aggregate.ID, T aggregate.Root[ID]]( conn *pgxpool.Pool, aggregateType aggregate.Type[ID, T], aggregateSerde serde.Bytes[T], messageSerde serde.Bytes[message.Message], ) AggregateRepository[ID, T]
NewAggregateRepository returns a new AggregateRepository instance.
type EventStore ¶
type EventStore struct {
// contains filtered or unexported fields
}
EventStore is an event.Store implementation targeted to PostgreSQL databases.
The implementation uses "event_streams" and "events" as their operational tables. Updates to these tables are transactional.
func NewEventStore ¶
NewEventStore returns a new EventStore instance.