Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregateBase ¶
type AggregateBase struct { ID string Type string Revision int Version int Time int64 // contains filtered or unexported fields }
AggregateBase entity
func (*AggregateBase) AddEvent ¶
func (a *AggregateBase) AddEvent(eventType string, eventData interface{})
AddEvent add and apply event
func (*AggregateBase) DecodeEvent ¶
func (a *AggregateBase) DecodeEvent(data []byte, v interface{}) error
DecodeEvent decode event data
func (*AggregateBase) GetAggregateBase ¶
func (a *AggregateBase) GetAggregateBase() *AggregateBase
GetAggregateBase return AggregateBase
type Encoder ¶
type Encoder interface { Encode(v interface{}) ([]byte, error) Decode(data []byte, vPtr interface{}) error }
Encoder encode and decode event data
type Event ¶
type Event struct { AggregateID string `json:"aggregateID" dynamodbav:"aggregateID" db:"aggregateID" msg:"a"` AggregateType string `json:"aggregateType" dynamodbav:"aggregateType" db:"aggregateType" msg:"b"` EventID string `json:"eventID" dynamodbav:"eventID" db:"eventID" msg:"c"` EventType string `json:"eventType" dynamodbav:"eventType" db:"eventType" msg:"d"` Revision int `json:"revision" dynamodbav:"revision" db:"revision" msg:"e"` Time int64 `json:"time" dynamodbav:"time" db:"time" msg:"f"` Data []byte `json:"data" dynamodbav:"data" db:"data" msg:"g"` }
Event entity
func (*Event) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type EventStore ¶
type EventStore interface { NewAggregateBase(id string, aggtype string, version int, applyFunc ApplyFunc) *AggregateBase GetStream(a Aggregate) error GetStreamWithSnapshot(a Aggregate) error Commit(a Aggregate) error SaveSnapshot(a Aggregate) error }
EventStore interface
func NewEventStore ¶
func NewEventStore(storage Storage, encoder Encoder, idgen IDGen) EventStore
NewEventStore create new event store
type Snapshot ¶
type Snapshot struct { AggregateID string `json:"aggregateID" dynamodbav:"aggregateID" db:"aggregateID"` AggregateType string `json:"aggregateType" dynamodbav:"aggregateType" db:"aggregateType"` AggregateVersion int `json:"aggregateVersion" dynamodbav:"aggregateVersion" db:"aggregateVersion"` Revision int `json:"revision" dynamodbav:"revision" db:"revision"` Time int64 `json:"time" dynamodbav:"time" db:"time"` Data []byte `json:"data" dynamodbav:"data" db:"data"` }
Snapshot entity
type Storage ¶
type Storage interface { Save(es []Event) error GetLastEvent(id string) ([]Event, error) SaveSnapshot(snap *Snapshot) error GetSnapshot(id string, version int) (*Snapshot, error) GetFromRevision(id string, from int) ([]Event, error) GetUndispatchedEvent() ([]Event, error) MarkDispatchedEvent(es []Event) error }
Storage interface
Source Files ¶
Click to show internal directories.
Click to hide internal directories.