events

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package events is the controller's in-process event bus (replaces Postgres LISTEN/NOTIFY, D5). Subscribers that fall behind lose events rather than blocking publishers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bus

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

func NewBus

func NewBus() *Bus

func (*Bus) Publish

func (b *Bus) Publish(topic string, data any)

func (*Bus) Subscribe

func (b *Bus) Subscribe(buffer int, topics ...string) *Sub

Subscribe returns a subscription to the given topics (all topics if none). Call Close when done.

type Event

type Event struct {
	Topic string    `json:"topic"`
	At    time.Time `json:"at"`
	Data  any       `json:"data"`
}

type Sub

type Sub struct {
	C <-chan Event
	// contains filtered or unexported fields
}

func (*Sub) Close

func (s *Sub) Close()

Jump to

Keyboard shortcuts

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