event

package
v2.26.3 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContext added in v2.11.0

func NewContext(ctx context.Context, d *Dispatcher) context.Context

Types

type Dispatcher

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

func FromContext added in v2.11.0

func FromContext(ctx context.Context) (*Dispatcher, bool)

func NewDispatcher

func NewDispatcher(opts ...Option) *Dispatcher

func (*Dispatcher) AddListener

func (d *Dispatcher) AddListener(listeners ...Listener)

func (*Dispatcher) Dispatch

func (d *Dispatcher) Dispatch(event Event)

func (*Dispatcher) DispatchAsync added in v2.10.0

func (d *Dispatcher) DispatchAsync(event Event)

func (*Dispatcher) Wait added in v2.11.0

func (d *Dispatcher) Wait()

type Event

type Event interface {
	Event() any
}

type Listener

type Listener interface {
	Listen() []Event
	Handle(event Event)
}

type Option

type Option func(*Dispatcher)

func WithRecovery

func WithRecovery(recovery func(err any, listener Listener, event Event)) Option

type Provider added in v2.11.0

type Provider struct {
	*Dispatcher
}

func NewProvider added in v2.11.0

func NewProvider(dispatcher *Dispatcher) *Provider

func (*Provider) Bootstrap added in v2.11.0

func (p *Provider) Bootstrap(ctx context.Context) (context.Context, error)

func (*Provider) Terminate added in v2.11.0

func (p *Provider) Terminate(ctx context.Context) (context.Context, error)

Jump to

Keyboard shortcuts

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