Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aggregator ¶
type Bus ¶
type Bus interface {
Publisher
Subscriber
}
type Event ¶
type Event struct {
// primary identifier for aggregate, like "SomeAggregate" or narrowed "<userId>:SomeAggregate"
// should be indexed
RowID string
// additional columns for aggregate, should be used for segregation/grouping
// Example: "entity_name" => "foo", "other_id" => "abcd123"
// should be indexed because most queries would sort/group on them
Columns map[string]interface{}
// type of the event, used by aggregators on subscribe
Type EventType
// should be indexed because most queries would sort by timestamp
Timestamp int64
// serialized event payload
Data []byte
// serializer/mapper used to encode data
Mapper string
}
Event contains serialized state of particular event that happened it is applied by aggregator to evaluate to current state (after this event)
type MemoryFlow ¶
type MemoryFlow struct {
// contains filtered or unexported fields
}
func InMemory ¶
func InMemory() *MemoryFlow
func (*MemoryFlow) Publish ¶
func (b *MemoryFlow) Publish(event Event) error
func (*MemoryFlow) Subscribe ¶
func (b *MemoryFlow) Subscribe(aggregator Aggregator, types ...EventType)
type Snapshot ¶
type Snapshot struct {
// primary identifier for aggregate, like "SomeAggregate" or narrowed "<userId>:SomeAggregate"
// should be indexed
RowID string
// should be indexed because most queries would sort by timestamp
Timestamp int64
// serialized state of aggregates
Data []byte
// serializer/mapper used to encode data
Mapper string
}
Snapshot contains serialized state of aggregates up to timestamp it can be used to speed up aggregate initialization
type Subscriber ¶
type Subscriber interface {
Subscribe(Aggregator, ...EventType)
}
Click to show internal directories.
Click to hide internal directories.