pg

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package pg is the plugin for PostgreSQL driver.

Index

Constants

This section is empty.

Variables

View Source
var (

	// SystemSchemaWhereClause is an optimization for getting less schema objects.
	SystemSchemaWhereClause = func() string {
		var schemas []string
		for schema := range systemSchemas {
			schemas = append(schemas, fmt.Sprintf("'%s'", schema))
		}
		return strings.Join(schemas, ",")
	}()
)

Functions

func IsSystemDatabase

func IsSystemDatabase(database string) bool

func IsSystemFunction

func IsSystemFunction(function string, definition string) bool

func IsSystemSchema

func IsSystemSchema(schema string) bool

func IsSystemTable

func IsSystemTable(table string) bool

func IsSystemView

func IsSystemView(view string) bool

Types

type ColumnOidKey

type ColumnOidKey struct {
	TableOid int
	ColumnID int
}

type Driver

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

Driver is the Postgres driver.

func (*Driver) Close

func (d *Driver) Close(context.Context) error

Close closes the driver.

func (*Driver) GetCurrentDatabaseOwner

func (d *Driver) GetCurrentDatabaseOwner(ctx context.Context) (string, error)

GetCurrentDatabaseOwner gets the role of the current database.

func (*Driver) GetDB

func (d *Driver) GetDB() *sql.DB

GetDB gets the database.

func (*Driver) GetSearchPath

func (d *Driver) GetSearchPath(ctx context.Context) (string, error)

GetSearchPath gets the current search path of the database. It returns the search path as a raw comma-separated string of schema names.

func (*Driver) Open

func (d *Driver) Open(ctx context.Context, _ storepb.Engine, config db.ConnectionConfig) (db.Driver, error)

Open opens a Postgres driver.

func (*Driver) Ping

func (d *Driver) Ping(ctx context.Context) error

Ping pings the database.

func (*Driver) SyncDBSchema

func (d *Driver) SyncDBSchema(ctx context.Context) (metadata *storepb.DatabaseSchemaMetadata, err error)

SyncDBSchema syncs a single database schema. A database the target no longer has is reported as common.NotFound, which is what tells a caller mirroring the target's inventory apart from a permission or connectivity failure.

func (*Driver) SyncInstance

func (d *Driver) SyncInstance(ctx context.Context) (*db.InstanceMetadata, error)

SyncInstance syncs the instance.

Jump to

Keyboard shortcuts

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