event

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: MIT Imports: 12 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func Register added in v0.10.2

func Register(ctx context.Context) error

func RegisterChannelQueue added in v0.8.0

func RegisterChannelQueue(ctx context.Context) error

Types

type ChannelQueue

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

func NewChannelQueue

func NewChannelQueue() *ChannelQueue

func (ChannelQueue) Pop

func (q ChannelQueue) Pop(events map[EventType]reflect.Type) (Event, error)

func (ChannelQueue) Push

func (q ChannelQueue) Push(e Event) error

type ChannelQueueConfig added in v0.10.2

type ChannelQueueConfig struct{}

func NewChannelQueueConfig added in v0.10.2

func NewChannelQueueConfig() *ChannelQueueConfig

func (*ChannelQueueConfig) Queue added in v0.10.2

func (c *ChannelQueueConfig) Queue() Queue

type Config added in v0.10.2

type Config interface {
	Queue() Queue
}

type Event

type Event interface {
	Type() EventType
}

type EventService added in v0.8.0

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

func Service added in v0.8.0

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

func (*EventService) Name added in v0.8.0

func (s *EventService) Name() string

func (*EventService) Run added in v0.8.0

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

type EventType

type EventType string

type Handler added in v0.8.0

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

type Listener added in v0.8.0

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

func NewListener added in v0.8.0

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

type Queue

type Queue interface {
	Push(e Event) error
	Pop(events map[EventType]reflect.Type) (Event, error)
}

type QueueConfiger added in v0.10.2

type QueueConfiger interface {
	QueueConfig() Config
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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