events

package
Version: v2.1.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2017 License: BSD-3-Clause Imports: 1 Imported by: 0

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().

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL