bus

package
v1.7.3-0...-caeaf44 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Type EventType
	Data any
}

Event represents an event in the system

type EventBus

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

EventBus is a central message broker for the application

func GetInstance

func GetInstance() *EventBus

func NewEventBus

func NewEventBus() *EventBus

NewEventBus creates a new instance of the event bus

func (*EventBus) Publish

func (eb *EventBus) Publish(event Event)

Publish sends an event to all subscribers of the given event type

func (*EventBus) Subscribe

func (eb *EventBus) Subscribe(eventType EventType, subscriberID string, handler Handler)

Subscribe registers a handler for a specific event type

func (*EventBus) Unsubscribe

func (eb *EventBus) Unsubscribe(eventType EventType, subscriberID string)

Unsubscribe removes a handler for a specific event type

type EventType

type EventType string

EventType defines the type of events that can be published

const (
	// EventGetDataModule is the event type for getting data modules
	EventGetDataModule EventType = "GET_DATA_MODULE"
	// EventDataModuleUpdate is the event type for data module updates
	EventDataModuleUpdate EventType = "DATA_MODULE_UPDATE"
)

type GetDataRequest

type GetDataRequest struct {
	Connection string             `json:"connection" mapstructure:"connection"`
	Modules    []types.ModuleName `json:"modules" mapstructure:"modules"`
}

GetDataRequest is the request for getting data modules

type Handler

type Handler func(event Event)

Handler is a function that handles events

Jump to

Keyboard shortcuts

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