event

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEventTypeNotFound = errors.New("event type not found")
)

Functions

func Register

func Register(ctx context.Context)

Types

type Dispatch

type Dispatch func(ctx context.Context, e Event) error

func NewDispatch

func NewDispatch(t pubsub.Topic) Dispatch

type Event

type Event interface {
	Type() EventType
}

type EventService

type EventService struct {
	PubSub pubsub.PubSub          `inject:""`
	Logger *slog.Logger           `inject:""`
	DP     *di.DependencyProvider `inject:""`
	// contains filtered or unexported fields
}

func Service

func Service(listeners ...*Listener) *EventService

func (*EventService) Name

func (s *EventService) Name() string

func (*EventService) Run

func (s *EventService) Run(ctx context.Context) error

type EventType

type EventType string

type Handler

type Handler[E Event] interface {
	Handle(ctx context.Context, event E) error
}

type Listener

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

func NewListener

func NewListener[H Handler[E], E Event]() *Listener

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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