event

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: Apache-2.0 Imports: 8 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OnEachBatch

func OnEachBatch[T comparable](b *Bus, fn func(ctx context.Context, data []T) error)

OnEachBatch registers a handler for a specific event type.

func OnEachBatchTx

func OnEachBatchTx[T, TTx comparable](b *Bus, fn func(ctx context.Context, tx TTx, data []T) error)

OnEachBatchTx registers a handler for a specific event type that is contingent on a transaction.

func RegisterJobSource

func RegisterJobSource[T comparable](b *Bus, newJobFn func(data T) (river.JobArgs, *river.InsertOpts))

RegisterJobSource registers a handler for a specific event type that creates jobs.

func Send

func Send[T comparable](ctx context.Context, b *Bus, event T)

Send sends an event to the bus.

func SendMany

func SendMany[T comparable](ctx context.Context, b *Bus, events []T)

Send sends an event to the bus.

func SendManyTx

func SendManyTx[T, TTx comparable](ctx context.Context, b *Bus, tx TTx, events []T)

SendTx sends an event to the bus that is contingent on a transaction.

func SendTx

func SendTx[T, TTx comparable](ctx context.Context, b *Bus, tx TTx, event T)

SendTx sends an event to the bus that is contingent on a transaction.

Types

type Bus

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

func NewBus

func NewBus(l *slog.Logger) *Bus

NewBus creates a new event bus.

func (*Bus) SetRiver

func (b *Bus) SetRiver(r *river.Client[pgx.Tx])

SetRiver sets the river client for the bus.

func (*Bus) SetRiverDBSQL

func (b *Bus) SetRiverDBSQL(r *river.Client[*sql.Tx])

SetRiverDBSQL sets the river client for the bus.

Jump to

Keyboard shortcuts

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