swoinfo

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ScanSequences

func ScanSequences(ctx context.Context, conn *pgx.Conn) ([]string, error)

ScanSequences will return the names of all sequences in the database, ordered by name.

Types

type ConnCount

type ConnCount struct {
	// Name is the application name of the connection.
	Name string

	// IsNext indicates that the connection is to the new database.
	IsNext bool

	Count int
}

ConnCount represents the number of connections to a database for the given application name.

func ConnInfo

func ConnInfo(ctx context.Context, oldConn, newConn *pgx.Conn) ([]ConnCount, error)

ConnInfo provides information about the connections to both old and new databases.

type DB

type DB struct {
	// ID is the UUID of the database, stored in the switchover_state table.
	ID      uuid.UUID
	Version string
}

DB contains information about a database.

func DBInfo

func DBInfo(ctx context.Context, conn *pgx.Conn) (*DB, error)

DBInfo provides information about the database associated with the given connection.

type Table

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

Table represents a table in the database.

func ScanTables

func ScanTables(ctx context.Context, conn *pgx.Conn) ([]Table, error)

ScanTables scans the database for tables returning them in insert-safe-order, meaning the first table returned will not have any foreign keys to other tables.

Tables with migrate-only data, or those used by switchover code will be omitted.

func (Table) Columns

func (t Table) Columns() []string

Columns returns the names of the columns in the table.

func (Table) IDType

func (t Table) IDType() string

IDType returns the type of the ID column.

func (Table) InsertJSONRowsQuery

func (t Table) InsertJSONRowsQuery(upsert bool) string

InsesrtJSONRowsQuery returns a query that can be used to insert or upsert rows from the given JSON data.

func (Table) Name

func (t Table) Name() string

Name returns the name of the table.

Jump to

Keyboard shortcuts

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