pg

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConnString = ConnString{"POSTGRES_HOSTNAME", "DB_PORT", "POSTGRES_USER", "POSTGRES_PASSWORD", "POSTGRES_DB", "SSL_MODE"}

Environment Variables

host=POSTGRES_HOSTNAME port=DB_PORT user=POSGRES_USER password=POSTGRES_PASSWORD dbname=POSTGRES_DB sslmode=SSL_MODE

Functions

func Exec

func Exec(db *pgx.Conn, query string, args ...any) error

func ExecContext

func ExecContext(ctx context.Context, db *pgx.Conn, query string, args ...any) error

func Query

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

func QueryContext

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

func QueryRow

func QueryRow(db *pgx.Conn, query string, scanner func(r pgx.Row) error, args ...any) error

func QueryRowContext

func QueryRowContext(ctx context.Context, db *pgx.Conn, query string, scanner func(r pgx.Row) error, args ...any) error

Types

type ConnString

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

func NewConnString

func NewConnString(hostname, port, username, password, dbName, sslMode string) *ConnString

func (*ConnString) ExpandEnv

func (c *ConnString) ExpandEnv() string

func (*ConnString) String

func (c *ConnString) String() string

Jump to

Keyboard shortcuts

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