Documentation
¶
Overview ¶
Package events defines common structures used for events dispatched from various other package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StatusUpdater ¶
type StatusUpdater struct {
Status string
// EventID is used to group the steps of a multi-part event.
// It is set internally the first time Update() is called.
EventID int64
}
StatusUpdater is a base struct for multi-part events with a status string that gets updated as the process progresses. StatusUpdater implements event.Updater, so if you embed a StatusUpdater into an event type, you can set a new status and dispatch that event in one call with DispatchUpdate.
For example:
type MyEvent struct {
StatusUpdater
}
ev := &MyEvent{}
event.DispatchUpdate(ev, "new status")
func (*StatusUpdater) Update ¶
func (su *StatusUpdater) Update(status interface{})
Update sets a new status and initializes the EventID if necessary. This implements event.Updater.Update().
Click to show internal directories.
Click to hide internal directories.