postgrespgxdb

package
v0.0.87 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

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

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

Variables

This section is empty.

Functions

This section is empty.

Types

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