pg

package
v0.0.0-...-5a762db Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(ctx context.Context, addr string, opts ...PGOpt) (*sql.DB, error)

Open opens a PostgreSQL database at the given host, returning an sql.DB.

Types

type PGOpt

type PGOpt func(opts *pgOptions)

PGOpt sets an option for the opener.

func WithDB

func WithDB(db string) PGOpt

WithDB changes the name of the database to connect to.

func WithDialAttempts

func WithDialAttempts(num int) PGOpt

WithDialAttempts allows the connection to be attempted multiple times before finally erroring out.

func WithPassword

func WithPassword(pwd string) PGOpt

WithPassword sets the connection password.

func WithUsername

func WithUsername(name string) PGOpt

WithUsername changes the username this database will use to connect.

Jump to

Keyboard shortcuts

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