cdc

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package cdc contains a utility for receiving notifications whenever the contents of a database table are changed.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Set is used by wire.
	Set = wire.NewSet(ProvideNotifier)
)

Functions

This section is empty.

Types

type Notification

type Notification struct {
	Table   string          // The table that was updated
	Key     json.RawMessage // The primary key for the table
	Payload json.RawMessage // The JSON payload associated with the notification
}

A Notification is emitted at least once for each data update.

func (*Notification) String

func (n *Notification) String() string

type Notifier

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

Notifier is a factory for CDC notification channels.

func ProvideNotifier

func ProvideNotifier(db *pgxpool.Pool, logger *log.Logger) *Notifier

ProvideNotifier is called by wire.

func (*Notifier) Notify

func (n *Notifier) Notify(ctx context.Context, tables []string) <-chan *Notification

Notify creates a new CDC notification channel which will run until the context is canceled.

Jump to

Keyboard shortcuts

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