event

package
v0.0.0-...-e7f8e0a Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Emit

func Emit(topic string, event any)

Emit and event to the given topic

func Stop

func Stop()

Stop stops the event stream, cleaning up its resources.

func Unsubscribe

func Unsubscribe(sub Subscription)

Unsubscribe unsubribes the given Subscription from its topic.

Types

type HandlerFunc

type HandlerFunc func(context.Context, any)

HandlerFunc is the function being called when receiving an event.

type Subscription

type Subscription struct {
	Topic     string
	CreatedAt int64
	Fn        HandlerFunc
}

Subscription represents a handler subscribed to a specific topic.

func Subscribe

func Subscribe(topic string, h HandlerFunc) Subscription

Subscribe a HandlerFunc to the given topic. A Subscription is being returned that can be used to unsubscribe from the topic.

Jump to

Keyboard shortcuts

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