event

package
v0.0.0-...-c86e3d9 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event interface {
	Type() string
	Payload() interface{}
	ShouldBeStored() bool
}

Event General event to override to create custom events

type EventApplyer

type EventApplyer interface {
	Apply(Event) error
	// contains filtered or unexported methods
}

EventApplyer To make to event

type EventBus

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

EventBus Contains handlers

func NewEventBus

func NewEventBus() *EventBus

NewEventBus Initialize empty handlers in bus

func (EventBus) AddHandler

func (eventBus EventBus) AddHandler(handler EventHandler, eventType string) error

AddHandler to bus

func (EventBus) Dispatch

func (eventBus EventBus) Dispatch(event Event) error

Dispatch Calls good event process

func (EventBus) GetEventsName

func (eventBus EventBus) GetEventsName() []string

GetEventName of registred event

func (EventBus) GetLength

func (eventBus EventBus) GetLength() int

GetLength of registred event

type EventHandler

type EventHandler interface {
	Handle(Event) error
}

EventHandler Allows to manage event

type EventImpl

type EventImpl struct {
	EventType string
	Content   interface{}
	StoreInDB bool
}

EventImpl Overrides Event

func NewEventImpl

func NewEventImpl(eventType string, eventContent interface{}, storeInDB bool) *EventImpl

NewEventImpl Initialize an Event implementation

func (EventImpl) Payload

func (event EventImpl) Payload() interface{}

Payload Returns event content

func (EventImpl) ShouldBeStored

func (event EventImpl) ShouldBeStored() bool

ShouldBeStored Returns bool to be abble to know if should be stored on DB

func (EventImpl) Type

func (event EventImpl) Type() string

Type Returns event type

Jump to

Keyboard shortcuts

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