notify

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const StartBeginning = -1

Variables

This section is empty.

Functions

func NewSyncNotifyListen

func NewSyncNotifyListen(postgresURI string, db *sqlx.DB) (pubsub.Notifier, pubsub.Listener, error)

Types

type DBListen

type DBListen struct {
	OnConnected func()
	// contains filtered or unexported fields
}

DBListen is used to listen for DB updates. Implements pubsub.Listener

func NewDBListen

func NewDBListen(connStr string, db *sqlx.DB) (*DBListen, error)

func (*DBListen) Close

func (d *DBListen) Close() error

func (*DBListen) Listen

func (d *DBListen) Listen(chanName string, pos int64, fn func(p pubsub.PartialWrapper)) error

Listen blocks forever. Reconnects when the connection is lost. Call Close() to stop listening. Returns an error if fails to listen. Returns nil if closed cleanly.

type DBNotifier

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

DBNotifier is used to send pg_notify notifications. Implements pubsub.Notifier

func NewDBNotifier

func NewDBNotifier(db *sqlx.DB) *DBNotifier

func (*DBNotifier) Notify

func (n *DBNotifier) Notify(chanName string, payload pubsub.Payload) error

type PayloadTable

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

func NewPayloadTableFromDB

func NewPayloadTableFromDB(db *sqlx.DB) *PayloadTable

func (*PayloadTable) Clean

func (t *PayloadTable) Clean(boundaryTs time.Time) error

Delete payloads older than boundaryTsMs

func (*PayloadTable) MaxID

func (t *PayloadTable) MaxID(txn *sqlx.Tx, chanName string) (id int64, err error)

type SyncDBNotifListener

type SyncDBNotifListener struct {
	*DBNotifier
	*DBListen
	// contains filtered or unexported fields
}

func (*SyncDBNotifListener) Listen

func (s *SyncDBNotifListener) Listen(chanName string, pos int64, fn func(p pubsub.PartialWrapper)) error

func (*SyncDBNotifListener) Notify

func (s *SyncDBNotifListener) Notify(chanName string, payload pubsub.Payload) error

Jump to

Keyboard shortcuts

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