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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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