Documentation
¶
Index ¶
- type Aggregate
- type AggregateRoot
- func (a *AggregateRoot) Apply(e Event)
- func (a *AggregateRoot) CommitEvents(version int64, handler func(e Event))
- func (a *AggregateRoot) Id() string
- func (a *AggregateRoot) LoadFromHistoricalEvents(stream Stream) *AggregateRoot
- func (a *AggregateRoot) Version() int64
- func (a *AggregateRoot) WithHandler(handler EventHandler) *AggregateRoot
- func (a *AggregateRoot) WithId(id string) *AggregateRoot
- func (a *AggregateRoot) WithVersion(v int64) *AggregateRoot
- type Commit
- type Event
- type EventHandler
- type EventList
- type EventModel
- type EventReplayer
- type Record
- type ReplayResult
- type Repository
- type Serializer
- type Stream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregateRoot ¶
type AggregateRoot struct {
// contains filtered or unexported fields
}
func (*AggregateRoot) Apply ¶
func (a *AggregateRoot) Apply(e Event)
func (*AggregateRoot) CommitEvents ¶
func (a *AggregateRoot) CommitEvents(version int64, handler func(e Event))
func (*AggregateRoot) Id ¶
func (a *AggregateRoot) Id() string
func (*AggregateRoot) LoadFromHistoricalEvents ¶
func (a *AggregateRoot) LoadFromHistoricalEvents(stream Stream) *AggregateRoot
func (*AggregateRoot) Version ¶
func (a *AggregateRoot) Version() int64
func (*AggregateRoot) WithHandler ¶
func (a *AggregateRoot) WithHandler(handler EventHandler) *AggregateRoot
func (*AggregateRoot) WithId ¶
func (a *AggregateRoot) WithId(id string) *AggregateRoot
func (*AggregateRoot) WithVersion ¶
func (a *AggregateRoot) WithVersion(v int64) *AggregateRoot
type Commit ¶
type Commit struct {
// contains filtered or unexported fields
}
func (*Commit) SetTimestamp ¶
type EventHandler ¶
type EventHandler interface {
On(e Event)
}
type EventModel ¶
type EventModel struct { // Sequence contains the event sequence number Sequence int64 `json:"seq"` // Timestamp contains the timestamp of the event Timestamp string `json:"ts"` }
func (*EventModel) EventSequence ¶
func (m *EventModel) EventSequence() int64
func (*EventModel) EventTimestamp ¶
func (m *EventModel) EventTimestamp() string
type EventReplayer ¶
type EventReplayer interface {
Replay(eventList EventList) ReplayResult
}
type Record ¶
type Record struct { // Data contains the event in serialized form Data []byte }
Record provides the serialized representation of the event
type ReplayResult ¶
type ReplayResult struct {
Error error
}
func Replay ¶
func Replay(handler EventHandler, eventList EventList) ReplayResult
func (ReplayResult) Failed ¶
func (r ReplayResult) Failed() bool
type Repository ¶
type Serializer ¶
type Serializer interface { // MarshalEvent converts an Event to a Record MarshalEvent(event Event) (Record, error) // UnmarshalEvent converts an Event backed into a Record UnmarshalEvent(record Record) (Event, error) }
Serializer converts between Events and Records
Click to show internal directories.
Click to hide internal directories.