event

package
v0.2.5-dev Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 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 Event

type Event[T any] interface {
	UnRegister(service, model string, handler Handler[T])
	Register(service, model string, handler Handler[T]) error
	RegisterFunc(service, model string, handler func(T)) Handler[T]
	Emit(service, model string, msg T) error
}

func NewSingleService

func NewSingleService[T any]() Event[T]

type Handler

type Handler[T any] interface {
	EventHandle(service, model string, msg T) error
}

type MutiEventMsg

type MutiEventMsg interface {
	GetId() string
}

type MutiEventServ

type MutiEventServ interface {
	Emit(service, model string, msg MutiEventMsg) error
	Register(service, model, msgId string, handler trans.Trans) error
	UnRegister(service, model, msgId string, handler trans.Trans)
	Run(context.Context)
}

func NewMultiService

func NewMultiService(cfg *config.Config) (MutiEventServ, error)

Jump to

Keyboard shortcuts

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