Documentation
¶
Overview ¶
Package eventsourcing is a generic, domain-agnostic decider host over store.EventStore: Load (snapshot + replay-tail via Evolve) and Append (encode + optimistic append + snapshot), parameterized per aggregate by a Decider value.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decider ¶
type Decider[S, E any] struct { Initial func() S Evolve func(S, E) S MarshalEvent func(E) (typeTag string, data []byte, err error) UnmarshalEvent func(typeTag string, data []byte) (E, error) MarshalSnapshot func(S) ([]byte, error) UnmarshalSnapshot func([]byte) (S, error) }
Decider bundles the per-aggregate funcs the host needs. Domains supply these as plain funcs; the host owns no domain types. Decide/React/action-execution and any fixpoint stay in the domain shell — only the event-sourcing plumbing is generic.
func (Decider[S, E]) Append ¶
func (d Decider[S, E]) Append(es *store.EventStore, streamID string, expectedVersion int, evs []E, newState S) error
Append encodes evs, appends them at expectedVersion (optimistic concurrency via store.EventStore), then snapshots newState at the resulting version. No-op when evs is empty. Returns store.ErrConcurrencyConflict on a version mismatch.