notifier

package
v0.22.91 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: MIT Imports: 9 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 interface connects to the database and allows callers to listen to a particular topic by issuing a LISTEN command. WaitForNotification blocks until receiving a notification or until the supplied context expires. The default implementation is tightly coupled to pgx (following River's implementation), but callers may implement their own listeners for any backend they'd like.

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