postgres

package
v0.0.0-...-5240c20 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnOptions

type ConnOptions struct {
	Host        string         `yaml:"host" validate:"required,hostname|ip"`
	Port        int            `yaml:"port" validate:"required,min=1024,max=65535"`
	Credentials Credentials    `yaml:"credentials" validate:"required"`
	DbName      string         `yaml:"db" validate:"required"`
	Timeout     model.Duration `yaml:"timeout" validate:"required"`
	Requests    []Request      `yaml:"requests" validate:"required,gt=0,unique=Sql,dive,required"`
}

ConnOptions postgres://username:password@host:port/db?sslmode=disable

type Credentials

type Credentials struct {
	ClientSet kubernetes.Interface
	Namespace string
	User      SecretKey `yaml:"username" validate:"required"`
	Password  SecretKey `yaml:"password" validate:"required"`
}

type Metric

type Metric struct {
	FieldName string `yaml:"fieldName" validate:"required,prometheus_label_name"`
	Label     string `yaml:"label,omitempty" validate:"omitempty,prometheus_label_name"`
	Regexp    string `yaml:"valueRegexp,omitempty" validate:"omitempty,notblank,property_regexp"`
}

type PgConnections

type PgConnections struct {
	Connections []ConnOptions `yaml:"connections" validate:"min=1,unique=Host"`
}

type Request

type Request struct {
	Sql         string   `yaml:"sql" validate:"required"`
	MetricName  string   `yaml:"metricName" validate:"required,prometheus_metric_name"`
	Metrics     []Metric `yaml:"metrics" validate:"required,gt=0,unique=FieldName,unique_labels,dive,required"`
	Description string   `yaml:"description,omitempty" validate:"omitempty,lte=100"`
}

type SecretKey

type SecretKey struct {
	Key  string `yaml:"key" validate:"required"`
	Name string `yaml:"name" validate:"required"`
}

type TxManager

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

func NewTxManager

func NewTxManager(pool pgxpoolmock.PgxPool) *TxManager

func (*TxManager) BatchResultClose

func (mgr *TxManager) BatchResultClose(ctx context.Context, br pgx.BatchResults) error

func (*TxManager) BeginRo

func (mgr *TxManager) BeginRo(ctx context.Context) (pgx.Tx, error)

func (*TxManager) Close

func (mgr *TxManager) Close()

func (*TxManager) Commit

func (mgr *TxManager) Commit(ctx context.Context, tx pgx.Tx) error

func (*TxManager) GetValues

func (mgr *TxManager) GetValues(ctx context.Context, rows pgx.Rows, br pgx.BatchResults) ([]interface{}, error)

func (*TxManager) Query

func (mgr *TxManager) Query(ctx context.Context, br pgx.BatchResults, sql string) (pgx.Rows, error)

func (*TxManager) Rollback

func (mgr *TxManager) Rollback(ctx context.Context, tx pgx.Tx) error

func (*TxManager) SendBatch

func (mgr *TxManager) SendBatch(ctx context.Context, tx pgx.Tx, batch *pgx.Batch) pgx.BatchResults

Jump to

Keyboard shortcuts

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