psql

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2022 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec

func Exec(q Q, query string, args ...any) error

func ExecContext

func ExecContext(ctx context.Context, q Q, query string, args ...any) error

func Query

func Query[T any](q Q, query string, scanner func(r pgx.Rows, v *T) error, args ...any) ([]T, error)

func QueryContext

func QueryContext[T any](ctx context.Context, q Q, query string, scanner func(r pgx.Rows, v *T) error, args ...any) ([]T, error)

func QueryRow

func QueryRow(q Q, query string, scanner func(r pgx.Row) error, args ...any) error

func QueryRowContext

func QueryRowContext(ctx context.Context, q Q, query string, scanner func(r pgx.Row) error, args ...any) error

Types

type C

type C interface {
	Close(ctx context.Context) error
	Begin(ctx context.Context) (pgx.Tx, error)
	BeginTx(ctx context.Context, txOptions pgx.TxOptions) (pgx.Tx, error)
	Q
	P
}

type P

type P interface {
	Prepare(ctx context.Context, name string, sql string) (sd *pgconn.StatementDescription, err error)
}

type Q

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

type T

type T interface {
	Commit(ctx context.Context) error
	Rollback(ctx context.Context) error
	P
	Q
}

Jump to

Keyboard shortcuts

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