Documentation ¶
Index ¶
Constants ¶
View Source
const EntityIDMetaKey = "EntityID"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aggregate ¶
type Aggregate interface { // Evolver means aggregates can be evolved with events rita.Evolver // Entity means aggregates have identity Entity }
Aggregate defines core behaviour of an aggregate.
Can evolve based on events and has identity.
type Entity ¶
type Entity interface {
EntityID() EntityID
}
Entity represents any struct or type that are identified by an EntityID.
type EventStore ¶
type EventStore[T rita.Evolver] interface { // Append event to stream // // expectSequence must be correct in order for the event to be appended. //If this event is expected to be the first for given entity then set expectSequence to zero. Append( ctx context.Context, id EntityID, data any, expectSequence uint64, ) (uint64, error) // Load and evolve entity into given target. Load( ctx context.Context, id EntityID, target T, ) (uint64, error) }
func NewEventStore ¶
func NewEventStore[T rita.Evolver](nc *nats.Conn, registry *types.Registry, streamName StreamName) ( EventStore[T], error, )
type StreamName ¶
type StreamName string
func (StreamName) Subject ¶
func (name StreamName) Subject() string
Click to show internal directories.
Click to hide internal directories.