Help us shape the future of Go! Take the 2026 Go Developer Survey

notifier

package
v1.0.166 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMinReconnectInterval = 10 * time.Millisecond
	DefaultMaxReconnectInterval = time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Listener

type Listener interface {
	io.Closer
	Listen(ctx context.Context, topic string, callback func(n *Notification)) error
}

Listener connects to PostgreSQL and listens to a channel with LISTEN. Listen calls the callback for every notification, with its JSON payload parsed, until the context is done. The default implementation, from NewListener, uses lib/pq; callers may implement Listener for another backend.

func NewListener

func NewListener(p xdb.Provider, minReconnectInterval time.Duration, maxReconnectInterval time.Duration) Listener

type Notification

type Notification struct {
	Channel string
	Payload values.MapAny
	// RawPayload, or the empty string if unspecified.
	RawPayload string
}

Jump to

Keyboard shortcuts

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