pgdb

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2022 License: Unlicense Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func BToI

func BToI(b bool) int

func IToB

func IToB(i int) bool

func IsDuplicate

func IsDuplicate(err error) bool

IsDuplicate - returns true if err is mysql duplicate entry notification

func IsForeignKeyConstraint

func IsForeignKeyConstraint(err error) bool

Types

type DBPool

type DBPool struct {
	DBCon *pgxpool.Pool
	// contains filtered or unexported fields
}

func NewDBPool

func NewDBPool(cparms string) (*DBPool, error)

NewDBPool - expects a postgresql connection string the in the form of "user=xxx password=xxxx host=xx.xx.xx.xx port=xxxx dbname=xxxx sslmode=?????"

func NewExternalDBPool

func NewExternalDBPool(cparms, tls_key, tls_cert string) (*DBPool, error)

NewExternalDBPool - requires TLS certificates to make the connection to the database expects a postgresql connection string the in the form of "user=xxx password=xxxx host=xx.xx.xx.xx port=xxxx dbname=xxxx sslmode=?????"

func (*DBPool) Close

func (p *DBPool) Close()

Close - shut down the current database connection pool

func (*DBPool) Execute

func (p *DBPool) Execute(q string, args ...interface{}) (int, error)

Execute - execute a sql command that returns no rows (gives count of rows affected)

func (*DBPool) GetCount

func (p *DBPool) GetCount(q string, args ...interface{}) (int, error)

GetCount - execute a sql query that returns a single integer value

func (*DBPool) IsConnected

func (p *DBPool) IsConnected() bool

IsConnected - returns true if we have a valid connection

func (*DBPool) Optimize

func (p *DBPool) Optimize() error

func (*DBPool) Query

func (p *DBPool) Query(q string, args ...interface{}) (pgx.Rows, error)

Jump to

Keyboard shortcuts

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