Documentation
¶
Index ¶
Constants ¶
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.