event

package
v0.2.3-dev Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 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 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