event

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SESSION_EXPIRIED = iota + 1
)

Variables

View Source
var DefaultEventBus = AsyncEventBus{
	// contains filtered or unexported fields
}

Functions

This section is empty.

Types

type AsyncEventBus

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

func (*AsyncEventBus) Publish

func (bus *AsyncEventBus) Publish(event Event)

func (*AsyncEventBus) Subscribe

func (bus *AsyncEventBus) Subscribe(eventType EventType, handler EventHandler)

type Event

type Event struct {
	EventType EventType
	Ts        int64
	Data      interface{}
}

func NewEvent

func NewEvent(eventType EventType, data any) Event

type EventBus

type EventBus interface {
	Publish(event Event)
	Subscribe(eventType EventType, handler EventHandler)
}

type EventHandler

type EventHandler func(event Event)

type EventType

type EventType int

Jump to

Keyboard shortcuts

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