events

package
v1.11.11 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeTo

func DecodeTo(data []byte, v interface{}) error

DecodeTo decodes a byte slice of event data into the given interface.

Types

type Bus

type Bus struct {
	*system.SinkPool
}

Bus represents an Event Bus.

func NewBus

func NewBus() *Bus

NewBus returns a new empty Bus. This is simply a nicer wrapper around the system.SinkPool implementation that allows for more simplistic usage within the codebase.

All of the events emitted out of this bus are byte slices that can be decoded back into an events.Event interface.

func (*Bus) Publish

func (b *Bus) Publish(topic string, data interface{})

Publish publishes a message to the Bus.

type Event

type Event struct {
	Topic string
	Data  interface{}
}

Event represents an Event sent over a Bus.

func MustDecode

func MustDecode(data []byte) (e Event)

MustDecode decodes the event byte slice back into an events.Event struct or panics if an error is encountered during this process.

Jump to

Keyboard shortcuts

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