pg

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	Clone    = "file_copy_clone"
	FileCopy = "file_copy"
	WALLog   = "wal_log"
	Default  = "default"
)

Variables

This section is empty.

Functions

func AllowConnections

func AllowConnections(ctx context.Context, db DB, name string, allow bool) error

func CloneAvailable

func CloneAvailable(ctx context.Context, db DB) (bool, error)

CloneAvailable reports whether the server accepts clone as a file_copy_method.

func Comment

func Comment(ctx context.Context, db DB, name string, m marker.Marker) error

func CopyACL

func CopyACL(ctx context.Context, db DB, source Database, target, owner string) (warnings []string, revokeFailed bool)

func CopySettings

func CopySettings(ctx context.Context, db DB, source Database, target string) []string

func CreateCopy

func CreateCopy(ctx context.Context, db DB, name, template, strategy string) (string, error)

func DatabaseSize

func DatabaseSize(ctx context.Context, db DB, oid uint32) (int64, error)

func Exec

func Exec(ctx context.Context, db DB, operation, sql string, args ...any) error

func Identifier

func Identifier(name string) string

func Rename

func Rename(ctx context.Context, db DB, name, target string) error

func SelectStrategy

func SelectStrategy(version int, configured string) (string, error)

func SessionCount

func SessionCount(ctx context.Context, db DB, name string) (int, error)

func SetComment

func SetComment(ctx context.Context, db DB, name string, comment *string) error

func State

func State(err error) string

func Terminate

func Terminate(ctx context.Context, db DB, name string) error

Types

type DB

type DB interface {
	Exec(context.Context, string, ...any) (pgconn.CommandTag, error)
	Query(context.Context, string, ...any) (pgx.Rows, error)
	QueryRow(context.Context, string, ...any) pgx.Row
}

type Database

type Database struct {
	Name             string
	OID              uint32
	Owner            string
	HasACL           bool
	AllowConnections bool
	Comment          *string
	Marker           marker.Marker
}

func Databases

func Databases(ctx context.Context, db DB) ([]Database, error)

func Lookup

func Lookup(ctx context.Context, db DB, name string) (Database, bool, error)

type Server

type Server struct {
	Version     string `json:"server_version"`
	VersionNum  int    `json:"server_version_num"`
	Role        string `json:"role"`
	IsSuperuser bool   `json:"is_superuser"`
	CanCreateDB bool   `json:"can_create_db"`
	Maintenance string `json:"maintenance_db"`
}

func ServerInfo

func ServerInfo(ctx context.Context, db DB) (Server, error)

Jump to

Keyboard shortcuts

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