postgrespgxdb

package
v0.0.92 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SCMPrepare  = "prepare"
	SCMDescribe = "describe"
)

StatementCacheMode values prepare - default describe - use it for PGBouncer connections

View Source
const (
	ConstraintErrorCode = "23505"
)

Variables

This section is empty.

Functions

func IsConstraintError added in v0.0.90

func IsConstraintError(err error, name string) bool

Types

type AffectedLessThenNecessaryError added in v0.0.90

type AffectedLessThenNecessaryError struct {
	Affected  int64
	Necessary int64
}

func (*AffectedLessThenNecessaryError) Error added in v0.0.90

type Config

type Config struct {
	Host               string
	Port               string
	Name               string
	User               string
	Password           string
	SSLMode            string
	BinaryParameters   string // lib/pq setting for prepared statements in pgbouncer
	StatementCacheMode string
	MaxConnections     string
}

Start Config -------------------------------------------------

func (*Config) GetDSN

func (cfg *Config) GetDSN() string

type Conn

type Conn struct {
	*pgxpool.Pool
	*types.DBLog
}

type DBQuery

type DBQuery interface {
	Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error)
	Query(ctx context.Context, sql string, optionsAndArgs ...interface{}) (pgx.Rows, error)
	QueryRow(ctx context.Context, sql string, optionsAndArgs ...interface{}) pgx.Row
	Begin(ctx context.Context) (pgx.Tx, error)
	BeginTx(ctx context.Context, txOptions pgx.TxOptions) (pgx.Tx, error)
	SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults
	Close()
	types.SQLLogger
}

Start Connect -------------------------------------------------

func New

func New(cfg *Config, log types.SQLLoggerFunc) (DBQuery, error)

Jump to

Keyboard shortcuts

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