pqutil

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Helpers for working with PostgreSQL databases

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenOnChannel

func ListenOnChannel(ctx context.Context, db string, channelName string, errorCallback func(error)) (<-chan *pq.Notification, error)

Connect to the the given PostgreSQL database (dbName, which must be a PostgreSQL connection string) and listen on the given channel (channelName) until the context is canceled. The database connection is kept alive with regular pings. If the connection is broken, it is automatically reestablished, and if errorCallback is non-nil, it will be invoked with details about the problem which caused the disconnection.

Returns a channel from which to read the notifications.

Types

This section is empty.

Jump to

Keyboard shortcuts

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