event

package
v0.0.0-...-d4e9f3a Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2016 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data map[string]interface{}

Data Data that comes with an event Works exactly like a JSON object []interface{} would be a JSON array

type Event

type Event struct {
	ID      int          // event unique Id
	Date    time.Time    // time of declenchment, allow to sort events
	Family  string       // event family
	Creator *interface{} // Object that triggered the event
	Data    Data         // Data that comes with the event, can be of any type
}

Event General type for an event

func New

func New(creator *interface{}, family string, data Data) (event *Event)

New Constructor that sets up event date to Now

func (*Event) SetDate

func (event *Event) SetDate(date time.Time)

SetDate Trigger an event at the specified date

func (*Event) SetDateNow

func (event *Event) SetDateNow()

SetDateNow Trigger an event now

type Eventer

type Eventer interface {
	Generate() Event // Genereate an event
}

Eventer An object able to generate an event

type Events

type Events []Event

Events An array of events

func (Events) Len

func (events Events) Len() int

Len Number of events

func (Events) Less

func (events Events) Less(i, j int) bool

Less return true if event i appends before event j

func (Events) Swap

func (events Events) Swap(i, j int)

Swap Swap two elements of the array

Jump to

Keyboard shortcuts

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