Documentation
¶
Index ¶
- func Dispatch(evt interface{})
- func SetDispatcher(disp Dispatcher)
- type Dispatcher
- type EventManager
- type EventStore
- type Listener
- type MemoryEventStore
- type MigrationEndedEvent
- type MigrationStartedEvent
- type MigrationsEndedEvent
- type MigrationsStartedEvent
- type QueryExecutedEvent
- type TransactionBeginningEvent
- type TransactionCommittedEvent
- type TransactionRolledBackEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Dispatcher ¶
type Dispatcher interface {
Publish(evt interface{})
}
Dispatcher is an interface for event dispatcher
type EventManager ¶
type EventManager struct {
// contains filtered or unexported fields
}
EventManager is a manager for event dispatch
func NewEventManager ¶
func NewEventManager(store EventStore) *EventManager
NewEventManager create a eventManager
func (*EventManager) Call ¶
func (em *EventManager) Call(evt interface{}, listener Listener)
Call trigger listener to execute
func (*EventManager) Listen ¶
func (em *EventManager) Listen(listeners ...Listener)
Listen create a relation from event to listners
type EventStore ¶
type EventStore interface {
Listen(eventName string, listener Listener)
Publish(eventName string, evt interface{})
SetManager(*EventManager)
}
EventStore is a interface for event store
type MemoryEventStore ¶
type MemoryEventStore struct {
// contains filtered or unexported fields
}
MemoryEventStore is a event store for sync operations
func NewMemoryEventStore ¶
func NewMemoryEventStore() *MemoryEventStore
NewMemoryEventStore create a sync event store
func (*MemoryEventStore) Listen ¶
func (eventStore *MemoryEventStore) Listen(evtType string, listener Listener)
Listen add a listener to a event
func (*MemoryEventStore) Publish ¶
func (eventStore *MemoryEventStore) Publish(evtType string, evt interface{})
Publish publish a event
func (*MemoryEventStore) SetManager ¶
func (eventStore *MemoryEventStore) SetManager(manager *EventManager)
SetManager event manager
type MigrationEndedEvent ¶
type MigrationEndedEvent struct {
SQL string
}
type MigrationStartedEvent ¶
type MigrationStartedEvent struct {
SQL string
}
type MigrationsEndedEvent ¶
type MigrationsEndedEvent struct{}
type MigrationsStartedEvent ¶
type MigrationsStartedEvent struct{}
type QueryExecutedEvent ¶
QueryExecutedEvent each SQL query executed by your application will publish a QueryExecutedEvent
type TransactionBeginningEvent ¶
type TransactionBeginningEvent struct{}
TransactionBeginningEvent fired when a new transaction started
type TransactionCommittedEvent ¶
type TransactionCommittedEvent struct{}
TransactionCommittedEvent fired when a transaction has been committed
type TransactionRolledBackEvent ¶
type TransactionRolledBackEvent struct{}
TransactionRolledBackEvent fired when a transaction has been rollback