Documentation ¶
Index ¶
- Constants
- func ApplyCommand(command Command, aggregate Aggregate)
- func RegisterEvent(event interface{})
- func Replay(aggregate Aggregate, events []Event)
- type Aggregate
- type BaseAggregate
- type BaseEvent
- type Capacity
- type Command
- type ConfirmOrderCommand
- type CreateOrderCommand
- type DbConfig
- type Event
- type EventStore
- func (es EventStore) CreateSnapshot(aggregateid, aggregatestate string, snapshot_event_seq int) error
- func (es EventStore) EventsForAggregate(aggregateid string, eventSeq int) []Event
- func (es EventStore) GetSnapshot(aggregateid string) string
- func (es EventStore) Persist(aggregate Aggregate) error
- func (es EventStore) PersistEvent(e Event) error
- type Order
- type OrderConfirmed
- type OrderCreated
- type OrderRevised
- type PersistentEvent
- type ReviseOrderCommand
- type RevisedStatus
Constants ¶
View Source
const JSON_DB_CONFIG_PATH = "./dbconfig/local_db.json"
Variables ¶
This section is empty.
Functions ¶
func ApplyCommand ¶
func RegisterEvent ¶
func RegisterEvent(event interface{})
Types ¶
type BaseAggregate ¶
type BaseAggregate struct { UUID string `json:"uuid"` Version int `json:"version"` LastModified time.Time `json:"lastModified"` Changes []Event `json:"changes"` }
func (*BaseAggregate) GetAggregateID ¶
func (a *BaseAggregate) GetAggregateID() string
func (*BaseAggregate) GetChanges ¶
func (a *BaseAggregate) GetChanges() []Event
func (*BaseAggregate) GetVersion ¶
func (a *BaseAggregate) GetVersion() int
func (*BaseAggregate) MarkAsCommited ¶
func (a *BaseAggregate) MarkAsCommited()
func (*BaseAggregate) UnmarshalJSON ¶
func (a *BaseAggregate) UnmarshalJSON(b []byte) error
type ConfirmOrderCommand ¶
type ConfirmOrderCommand struct {
ConfirmedBy string
}
func (ConfirmOrderCommand) CreateBaseEvent ¶
func (coc ConfirmOrderCommand) CreateBaseEvent() BaseEvent
type CreateOrderCommand ¶
func (CreateOrderCommand) CreateBaseEvent ¶
func (coc CreateOrderCommand) CreateBaseEvent() BaseEvent
type Event ¶
type Event struct { AggregateID string AggregateType string EventType string CreatedAt time.Time Sequence int Payload interface{} }
func BuildEvent ¶
func (Event) ApplyChanges ¶
func (*Event) MarshalJSON ¶
func (Event) Serialize ¶
func (e Event) Serialize() (PersistentEvent, error)
type EventStore ¶
type EventStore struct{}
func (EventStore) CreateSnapshot ¶
func (es EventStore) CreateSnapshot(aggregateid, aggregatestate string, snapshot_event_seq int) error
func (EventStore) EventsForAggregate ¶
func (es EventStore) EventsForAggregate(aggregateid string, eventSeq int) []Event
func (EventStore) GetSnapshot ¶
func (es EventStore) GetSnapshot(aggregateid string) string
func (EventStore) Persist ¶
func (es EventStore) Persist(aggregate Aggregate) error
func (EventStore) PersistEvent ¶
func (es EventStore) PersistEvent(e Event) error
PersistEvent persists an Event in the event store
type Order ¶
type Order struct { BaseAggregate Capacity Capacity ConfirmedBy string RevisedStat RevisedStatus }
type OrderConfirmed ¶
type OrderConfirmed struct {
ConfirmedBy string `json:"confirmedBy"`
}
func (OrderConfirmed) Apply ¶
func (oc OrderConfirmed) Apply(aggregate Aggregate, event *Event)
func (OrderConfirmed) GetAggregateType ¶
func (OrderConfirmed) GetAggregateType() string
func (OrderConfirmed) GetCreatedAt ¶
func (OrderConfirmed) GetCreatedAt() time.Time
func (OrderConfirmed) GetEventType ¶
func (OrderConfirmed) GetEventType() string
func (OrderConfirmed) GetSequence ¶
func (OrderConfirmed) GetSequence() int
type OrderCreated ¶
func (OrderCreated) Apply ¶
func (oc OrderCreated) Apply(aggregate Aggregate, event *Event)
func (OrderCreated) GetAggregateType ¶
func (OrderCreated) GetAggregateType() string
func (OrderCreated) GetCreatedAt ¶
func (OrderCreated) GetCreatedAt() time.Time
func (OrderCreated) GetEventType ¶
func (OrderCreated) GetEventType() string
func (OrderCreated) GetSequence ¶
func (OrderCreated) GetSequence() int
type OrderRevised ¶
func (OrderRevised) Apply ¶
func (or OrderRevised) Apply(aggregate Aggregate, event *Event)
func (OrderRevised) GetAggregateType ¶
func (OrderRevised) GetAggregateType() string
func (OrderRevised) GetCreatedAt ¶
func (OrderRevised) GetCreatedAt() time.Time
func (OrderRevised) GetEventType ¶
func (OrderRevised) GetEventType() string
func (OrderRevised) GetSequence ¶
func (OrderRevised) GetSequence() int
type PersistentEvent ¶
type PersistentEvent struct { AggregateID string AggregateType string EventType string CreatedAt time.Time Sequence int RawData string }
func (PersistentEvent) Deserialize ¶
func (e PersistentEvent) Deserialize() (Event, error)
type ReviseOrderCommand ¶
func (ReviseOrderCommand) CreateBaseEvent ¶
func (roc ReviseOrderCommand) CreateBaseEvent() BaseEvent
type RevisedStatus ¶
Click to show internal directories.
Click to hide internal directories.