gopgx

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Db

type Db struct {
	Host, DbName, Port, User string
	Instance                 *pgx.Conn
	// contains filtered or unexported fields
}

Db struct is used to configuure database and store a Connection instance

func (*Db) Ping

func (db *Db) Ping(msg string) error

Ping prints the message passed, can be used for checking the database connection

func (*Db) SetPassword

func (db *Db) SetPassword(f PasswordSetter) error

SetPassword sets the db password through passing a function which returns a string and an error

func (*Db) Setup

func (db *Db) Setup(ctx context.Context) error

Setup connects to the postgres database server and verifies the connection using Ping

type PasswordSetter added in v1.1.0

type PasswordSetter func() (string, error)

PasswordSetter type along with func SetPassword enables setting password via env var, api or any other way.

Jump to

Keyboard shortcuts

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