Documentation ¶
Index ¶
- Variables
- func GetTypeName(source interface{}) (reflect.Type, string)
- type Consumer
- type DomainEvent
- func (e *DomainEvent) GetAggregateID() string
- func (e *DomainEvent) GetAggregateType() string
- func (e *DomainEvent) GetData() interface{}
- func (e *DomainEvent) GetEventType() string
- func (e *DomainEvent) GetID() uuid.UUID
- func (e *DomainEvent) GetVersion() int
- func (e *DomainEvent) SetEventType(et string)
- func (e *DomainEvent) SetTimestamp() time.Time
- func (e *DomainEvent) SetVersion(v int)
- type Event
- type MessageHandlerFunc
- type Producer
- type RoleCreatedEvent
- type RoleDescriptionChangedEvent
- type RolePermissionUpdatedEvent
- type Store
- type TypeMapper
- type UserCreatedEvent
- type UserEmailChangedEvent
- type UserPasswordChangedEvent
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNewEventTypeMapper = errors.New("unknown event")
)
Functions ¶
func GetTypeName ¶
GetTypeName of given struct.
Types ¶
type DomainEvent ¶
type DomainEvent struct { ID uuid.UUID // 事件唯一ID EventType string // 事件的Type名稱,例如:AccountCreatedEvent Data interface{} // 事件資料,例如&AccountCreatedEvent{} CreatedAt time.Time AggregateType string // 事件所屬的Aggregate Type,例如AccountCreatedEvent屬於Account AggregateID string // aggregate儲存在資料庫,相對應的ID Version int // aggregate的版本 }
func NewDomainEvent ¶
func NewDomainEvent(aggregateID, aggregateType string, version int, data interface{}) *DomainEvent
func (*DomainEvent) GetAggregateID ¶
func (e *DomainEvent) GetAggregateID() string
AggregateID implements the AggregateID method of the Event interface.
func (*DomainEvent) GetAggregateType ¶
func (e *DomainEvent) GetAggregateType() string
AggregateType implements the AggregateType method of the Event interface.
func (*DomainEvent) GetData ¶
func (e *DomainEvent) GetData() interface{}
Data implements the Data method of the Event interface.
func (*DomainEvent) GetEventType ¶
func (e *DomainEvent) GetEventType() string
EventType implements the EventType method of the Event interface.
func (*DomainEvent) GetID ¶
func (e *DomainEvent) GetID() uuid.UUID
func (*DomainEvent) GetVersion ¶
func (e *DomainEvent) GetVersion() int
Version implements the Version method of the Event interface.
func (*DomainEvent) SetEventType ¶
func (e *DomainEvent) SetEventType(et string)
func (*DomainEvent) SetTimestamp ¶
func (e *DomainEvent) SetTimestamp() time.Time
Timestamp implements the Timestamp method of the Event interface.
func (*DomainEvent) SetVersion ¶
func (e *DomainEvent) SetVersion(v int)
type MessageHandlerFunc ¶
type RoleCreatedEvent ¶
type RoleDescriptionChangedEvent ¶
type RoleDescriptionChangedEvent struct {
Description string `json:"description"`
}
type RolePermissionUpdatedEvent ¶
type RolePermissionUpdatedEvent struct {
Permissions []string `json:"permissions"`
}
type TypeMapper ¶
type TypeMapper struct {
// contains filtered or unexported fields
}
func NewEventTypeMapper ¶
func NewEventTypeMapper() *TypeMapper
func (*TypeMapper) NewInstance ¶
func (m *TypeMapper) NewInstance(eventName string) (event interface{}, err error)
func (*TypeMapper) Register ¶
func (m *TypeMapper) Register(event interface{})
type UserCreatedEvent ¶
type UserEmailChangedEvent ¶
type UserEmailChangedEvent struct {
EMail string `json:"email"`
}
type UserPasswordChangedEvent ¶
type UserPasswordChangedEvent struct {
Password string `json:"password"`
}
Click to show internal directories.
Click to hide internal directories.