database

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// based the os package error names:
	// https://pkg.go.dev/os#pkg-variables
	ErrExist    = errors.New("database: already exists")
	ErrNotExist = errors.New("database: does not exist")

	// storage errors
	ErrRetry    = errors.New("database: retry storage operation")
	ErrConflict = errors.New("database: conflict in storage operation")
)

Functions

func Connect

func Connect(uri string) (*pgx.Conn, error)

func ConnectPool

func ConnectPool(uri string) (*pgxpool.Pool, error)

func Exec

func Exec(db Conn, ctx context.Context, stmt string, args ...interface{}) error

func Scan

func Scan(row pgx.Row, dest ...interface{}) error

Types

type Conn

type Conn interface {
	Exec(ctx context.Context, sql string, args ...interface{}) (pgconn.CommandTag, error)
	Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
	QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row
}

Common interface for pgx.Conn, pgx.Pool, pgx.Tx, etc https://github.com/jackc/pgx/issues/875

Jump to

Keyboard shortcuts

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