eventbus

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bus

type Bus struct {
	// contains filtered or unexported fields
}

Bus that stores the events and dispatches them to the subscribers

func NewBus

func NewBus(c service.Container) (b *Bus, err error)

NewBus constructor

func (*Bus) Emit

func (b *Bus) Emit(eventName string, data interface{})

Emit publishes a event on all subscribing channels

func (*Bus) On

func (b *Bus) On(eventName string, ch EventChannel)

On subscribes a channel to a event on the bus

type Event

type Event struct {
	storage.Entity
	RawData interface{} `json:"-" gorm:"-"`
	Data    string      `json:"data"`
	Event   string      `json:"event"`
}

Event that triggers a state change

type EventChannel

type EventChannel chan Event

EventChannel channel that transports events

type EventModel

type EventModel struct {
	storage.Model
}

EventModel storage model

func (*EventModel) GetAll

func (m *EventModel) GetAll(tx *storage.Transaction, entries *[]Event) error

GetAll events

Jump to

Keyboard shortcuts

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