bus

package
v0.0.0-...-04c4af4 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultEventBus

type DefaultEventBus struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*DefaultEventBus) Publish

func (d *DefaultEventBus) Publish(ctx context.Context, event Event) error

func (*DefaultEventBus) Subscribe

func (d *DefaultEventBus) Subscribe(fn HandlerFunc)

type Event

type Event any

Event defines a event interface.

type EventBus

type EventBus interface {
	Subscribe(fn HandlerFunc)
	Publish(ctx context.Context, event Event) error
}

EventBus type defines the bus interface structure.

func New

func New() EventBus

type HandlerFunc

type HandlerFunc any

HandlerFunc defines a handler function interface.

type ProjectCreatedEvent

type ProjectCreatedEvent struct {
	ProjectID   int32
	ProjectName string
}

Jump to

Keyboard shortcuts

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