psql

package module
v0.0.0-...-f03c6e0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

README

psql

Basic psql wrapper for PGX and Scany with mocks

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandTag

type CommandTag interface {
	fmt.Stringer
	RowsAffected() int64
	Insert() bool
	Update() bool
	Delete() bool
	Select() bool
}

type Config

type Config = pgxpool.Config

type Conn

type Conn interface {
	Queryer
	Exec(ctx context.Context, stmt string, args ...any) (CommandTag, error)
}

type DB

type DB interface {
	Conn
	io.Closer
	Ping(ctx context.Context) error
	Begin(ctx context.Context) (Tx, error)
}

func New

func New(ctx context.Context, cxn string) (DB, error)

func NewWithConfig

func NewWithConfig(ctx context.Context, cfg *Config) (DB, error)

type Queryer

type Queryer interface {
	Query(ctx context.Context, dst any, query string, args ...any) error
	QueryRow(ctx context.Context, dst any, query string, args ...any) error
}

type Tx

type Tx interface {
	Conn
	Commit(ctx context.Context) error
	Rollback(ctx context.Context) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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