db

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SnapshotData

func SnapshotData(session *Session, requestParams *types.SnapshotDataJSON) ([]map[string]interface{}, error)

SnapshotData queries the snapshot for data from the given table and returns the results as a JSON array

Types

type Config added in v0.1.8

type Config struct {
	*pgx.ConnConfig
	SlotName string
}

func (*Config) WithDB added in v0.1.8

func (cfg *Config) WithDB(dbName, pgUser, pgPass, pgHost string, pgPort int) *Config

Initialize the database configuration

type Session added in v0.1.8

type Session struct {
	ReplConn *pgx.ReplicationConn
	PGConn   *pgx.Conn

	Out chan types.Wal2JSONEvent

	SnapshotName string
	RestartLSN   uint64
	Logger       logger.Logger
	// contains filtered or unexported fields
}

Session stores the context, active db and ws connections, and replication slot state

func NewSession added in v0.1.8

func NewSession(cfg *Config, log logger.Logger) (session *Session, retErr error)

func (*Session) AckLSN added in v0.1.8

func (session *Session) AckLSN(restartLSNStr string) error

LRAckLSN will set the flushed LSN value and trigger a StandbyStatus update

func (*Session) Close added in v0.1.9

func (session *Session) Close()

func (*Session) DeleteAllSlots added in v0.1.8

func (session *Session) DeleteAllSlots() error

delete all old slots that were created by us

func (*Session) EnsureSlot added in v0.1.9

func (session *Session) EnsureSlot() error

func (*Session) LRStream added in v0.1.8

func (session *Session) LRStream(ctx context.Context) error

LRStream will start streaming changes from the given slotName over the websocket connection

func (*Session) ReCreateReplConn added in v0.1.8

func (session *Session) ReCreateReplConn() error

CheckAndCreateReplConn creates a new replication connection

Jump to

Keyboard shortcuts

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