Documentation
¶
Index ¶
- func RegisterEventMapper(aggregateType AggregateType, eventType EventType, ...)
- type Aggregate
- type AggregateType
- type AggregateVersion
- type Command
- type Event
- type EventBase
- func (eb *EventBase) GetAggregate() *Aggregate
- func (eb *EventBase) GetCausationId() *string
- func (eb *EventBase) GetCorrelationId() *string
- func (eb *EventBase) GetCreatedAt() time.Time
- func (eb *EventBase) GetCreator() *string
- func (eb *EventBase) GetId() string
- func (eb *EventBase) GetPayloadBytes() []byte
- func (eb *EventBase) GetPosition() decimal.Decimal
- func (eb *EventBase) GetType() EventType
- func (eb *EventBase) UnmarshalPayload(ptr any) error
- type EventStore
- type EventType
- type Query
- type QueryBuilder
- type ReadModel
- type Reducer
- type Session
- type Subscription
- type WriteModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterEventMapper ¶
func RegisterEventMapper(aggregateType AggregateType, eventType EventType, eventMapper func(Event) (Event, error))
Types ¶
type AggregateType ¶
type AggregateType string
type AggregateVersion ¶
type AggregateVersion string
func (AggregateVersion) Int ¶
func (av AggregateVersion) Int() (error, int)
type Command ¶
type Command interface {
GetPayload() any
// contains filtered or unexported methods
}
type EventBase ¶
type EventBase struct {
Aggregate *Aggregate `json:"-"`
Id string `json:"-"`
Type EventType `json:"-"`
Payload []byte `json:"-"`
Creator *string `json:"-"`
CorrelationId *string `json:"-"`
CausationId *string `json:"-"`
Position decimal.Decimal `json:"-"`
CreatedAt time.Time `json:"-"`
}
func EventBaseFromEvent ¶
func (*EventBase) GetAggregate ¶
func (*EventBase) GetCausationId ¶
func (*EventBase) GetCorrelationId ¶
func (*EventBase) GetCreatedAt ¶
func (*EventBase) GetCreator ¶
func (*EventBase) GetPayloadBytes ¶
func (*EventBase) GetPosition ¶
func (*EventBase) UnmarshalPayload ¶
type EventStore ¶
type EventStore struct {
// contains filtered or unexported fields
}
func NewEventStore ¶
func NewEventStore(db *database.Db) *EventStore
func (*EventStore) NewSession ¶
func (es *EventStore) NewSession(ctx context.Context) (*Session, error)
type QueryBuilder ¶
type QueryBuilder struct {
// contains filtered or unexported fields
}
func NewQuery ¶
func NewQuery() *QueryBuilder
type ReadModel ¶
type ReadModel struct {
TenantId string `json:"-"`
AggregateId string `json:"-"`
AggregateSequence int64 `json:"-"`
Owner string `json:"-"`
Events []Event `json:"-"`
Position decimal.Decimal `json:"-"`
CreatedAt time.Time `json:"-"`
UpdatedAt time.Time `json:"-"`
}
func (*ReadModel) AppendEvents ¶
func (*ReadModel) Query ¶
func (rm *ReadModel) Query() *QueryBuilder
type Reducer ¶
type Reducer interface {
Query() *QueryBuilder
AppendEvents(events ...Event)
Reduce() error
}
type Subscription ¶
type Subscription struct {
Events chan Event
// contains filtered or unexported fields
}
func SubscribeAggregates ¶
func SubscribeAggregates(eventQueue chan Event, aggregates ...AggregateType) *Subscription
func SubscribeEventTypes ¶
func SubscribeEventTypes(eventQueue chan Event, types map[AggregateType][]EventType) *Subscription
func (*Subscription) Unsubscribe ¶
func (s *Subscription) Unsubscribe()
type WriteModel ¶
type WriteModel struct {
TenantId string `json:"-"`
AggregateId string `json:"-"`
AggregateSequence int64 `json:"-"`
Owner string `json:"-"`
Events []Event `json:"-"`
Position decimal.Decimal `json:"-"`
CreatedAt time.Time `json:"-"`
UpdatedAt time.Time `json:"-"`
}
func (*WriteModel) AppendEvents ¶
func (wm *WriteModel) AppendEvents(events ...Event)
func (*WriteModel) Query ¶
func (wm *WriteModel) Query() *QueryBuilder
func (*WriteModel) Reduce ¶
func (wm *WriteModel) Reduce() error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.