psql

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Commit

func Commit(ctx context.Context, tx *sqlx.Tx, err error) error

func IsDuplicateKey

func IsDuplicateKey(err error) bool

func Rollback

func Rollback(ctx context.Context, tx *sqlx.Tx, err error) error

Types

type PSQLHandler

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

func NewPSQLDBHandler

func NewPSQLDBHandler(host, dbname, user, password string, port int, sslmode SSLMode) (*PSQLHandler, error)

Postgres Connection Object. Wraps a sqlx.DB and provides a DBConnection() method to access the DB Connection

func NewPSQLDBHandlerFromString

func NewPSQLDBHandlerFromString(str string) (*PSQLHandler, error)

func (*PSQLHandler) Close

func (t *PSQLHandler) Close()

func (*PSQLHandler) DB

func (t *PSQLHandler) DB() *sqlx.DB

func (*PSQLHandler) Delete

func (t *PSQLHandler) Delete(ctx context.Context, query string, params ...interface{}) (int64, error)

func (*PSQLHandler) Get

func (t *PSQLHandler) Get(ctx context.Context, result interface{}, query string, params ...interface{}) error

func (*PSQLHandler) GetById

func (t *PSQLHandler) GetById(ctx context.Context, result interface{}, query string, id interface{}) error

func (*PSQLHandler) Host

func (t *PSQLHandler) Host() string

func (*PSQLHandler) Insert

func (t *PSQLHandler) Insert(ctx context.Context, query string, params ...interface{}) error

func (*PSQLHandler) InsertWithId

func (t *PSQLHandler) InsertWithId(ctx context.Context, query string, params ...interface{}) (int64, error)

func (*PSQLHandler) Name

func (t *PSQLHandler) Name() string

func (*PSQLHandler) Ping

func (t *PSQLHandler) Ping() error

func (*PSQLHandler) Port

func (t *PSQLHandler) Port() string

func (*PSQLHandler) Select

func (t *PSQLHandler) Select(ctx context.Context, results interface{}, query string, params ...interface{}) error

func (*PSQLHandler) Update

func (t *PSQLHandler) Update(ctx context.Context, query string, params ...interface{}) (int64, error)

type SSLMode

type SSLMode string
const (
	SSLModeDisable SSLMode = "disable"     // No SSL
	SSLModeRequire SSLMode = "require"     // Always SSL (skip verification)
	SSLModeFull    SSLMode = "verify-full" // Always SSL (require verification)
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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