postgres

package
v0.0.0-...-0ad5b3e Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetricsCriteria = "metrics_criteria"
	Entities        = "entities"
)
View Source
const EnvTechURL = "CPS_POSTGRES_TECH_URL"
View Source
const EnvURL = "CPS_POSTGRES_URL"

Variables

This section is empty.

Functions

func Dump

func Dump(connStr, filepath string) error

Dump calls pg_dump binary.

func GetConnStr

func GetConnStr() (string, error)

func GetTechConnStr

func GetTechConnStr() (string, error)

func IsConnectionError

func IsConnectionError(err error) bool

Types

type BasePool

type BasePool interface {
	Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error)
	Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
	QueryRow(ctx context.Context, sql string, args ...any) pgx.Row
	SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults
	Begin(ctx context.Context) (pgx.Tx, error)
	Close()
	Stat() *pgxpool.Stat
	Ping(ctx context.Context) error
	CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)
}

type Pool

type Pool interface {
	Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error)
	Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
	QueryRow(ctx context.Context, sql string, args ...any) pgx.Row
	SendBatch(ctx context.Context, b *pgx.Batch) error
	Close()
	WithTransaction(ctx context.Context, f func(context.Context, pgx.Tx) error) error
	Ping(ctx context.Context) error
	CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)
}

func NewPool

func NewPool(ctx context.Context, retryCount int, minRetryTimeout time.Duration) (Pool, error)

func NewTechMetricsPool

func NewTechMetricsPool(ctx context.Context, retryCount int, minRetryTimeout time.Duration) (Pool, error)

type PoolProvider

type PoolProvider interface {
	Get(ctx context.Context) (Pool, error)
	Close()
}

func NewPoolProvider

func NewPoolProvider(retryCount int, minRetryTimeout time.Duration) PoolProvider

Jump to

Keyboard shortcuts

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