Documentation ¶
Index ¶
- type Aggregate
- type AggregateRoot
- func (ar *AggregateRoot) AggregateID() string
- func (ar *AggregateRoot) AggregateType() string
- func (ar *AggregateRoot) ApplyChange(agg Aggregate, data interface{})
- func (ar *AggregateRoot) ApplyChangeWithMetadata(agg Aggregate, data interface{}, metadata map[string]interface{})
- func (ar *AggregateRoot) BaseVersion() int
- func (ar *AggregateRoot) CloneEvents() []Event
- func (ar *AggregateRoot) Events() []Event
- func (ar *AggregateRoot) IsUnsaved() bool
- func (ar *AggregateRoot) LoadFromHistory(agg Aggregate, events []Event)
- func (ar *AggregateRoot) Root() *AggregateRoot
- func (ar *AggregateRoot) SetAggregateType(typ string)
- func (ar *AggregateRoot) SetID(id string) error
- func (ar *AggregateRoot) SetInternal(id string, baseVersion, version int)
- func (ar *AggregateRoot) Update()
- func (ar *AggregateRoot) Version() int
- type BaseAggregate
- type Event
- type RegisterEventsFunc
- type Serializer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aggregate ¶
type Aggregate interface { BaseAggregate Root() *AggregateRoot Transition(e Event) }
All aggregate must implement this interface
type AggregateRoot ¶
type AggregateRoot struct {
// contains filtered or unexported fields
}
func (*AggregateRoot) AggregateID ¶
func (ar *AggregateRoot) AggregateID() string
func (*AggregateRoot) AggregateType ¶
func (ar *AggregateRoot) AggregateType() string
func (*AggregateRoot) ApplyChange ¶
func (ar *AggregateRoot) ApplyChange(agg Aggregate, data interface{})
ApplyChange apply data change on aggregate
func (*AggregateRoot) ApplyChangeWithMetadata ¶
func (ar *AggregateRoot) ApplyChangeWithMetadata(agg Aggregate, data interface{}, metadata map[string]interface{})
func (*AggregateRoot) BaseVersion ¶
func (ar *AggregateRoot) BaseVersion() int
BaseVersion is the version of current aggregate in database
func (*AggregateRoot) CloneEvents ¶
func (ar *AggregateRoot) CloneEvents() []Event
CloneEvents return new slice of events
func (*AggregateRoot) Events ¶
func (ar *AggregateRoot) Events() []Event
func (*AggregateRoot) IsUnsaved ¶
func (ar *AggregateRoot) IsUnsaved() bool
func (*AggregateRoot) LoadFromHistory ¶
func (ar *AggregateRoot) LoadFromHistory(agg Aggregate, events []Event)
LoadFromHistory build aggregate from list event
func (*AggregateRoot) Root ¶
func (ar *AggregateRoot) Root() *AggregateRoot
func (*AggregateRoot) SetAggregateType ¶
func (ar *AggregateRoot) SetAggregateType(typ string)
func (*AggregateRoot) SetID ¶
func (ar *AggregateRoot) SetID(id string) error
func (*AggregateRoot) SetInternal ¶
func (ar *AggregateRoot) SetInternal(id string, baseVersion, version int)
setInternal set common data to AggregateRoot
func (*AggregateRoot) Version ¶
func (ar *AggregateRoot) Version() int
Version is the version of aggregate not stored
type BaseAggregate ¶
type BaseAggregate interface {
RegisterEvents(RegisterEventsFunc) error
}
type RegisterEventsFunc ¶
type RegisterEventsFunc = func(events ...interface{}) error
type Serializer ¶
type Serializer interface { ToEventsFunc(events ...interface{}) []eventFunc RegisterAggregate(agg BaseAggregate) error Register(agg Aggregate, eventsFunc []eventFunc) error RegisterTypes(agg Aggregate, eventsFunc ...eventFunc) error Type(typ, name string) (eventFunc, bool) Marshal(v interface{}) ([]byte, error) Unmarshal(data []byte, v interface{}) error }
func NewSerializer ¶
func NewSerializer() Serializer
Click to show internal directories.
Click to hide internal directories.