db

package
v3.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2020 License: MIT Imports: 7 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoHost occurs when host is not provided in configuration
	ErrNoHost = errors.New("no host for database connection")
)

Functions

func EndTx

func EndTx(tx *sql.Tx, err error) error

EndTx ends transaction according error without shadowing given error

func GetTx

func GetTx(db *sql.DB, tx *sql.Tx) (*sql.Tx, error)

GetTx return given transaction if not nil or create a new one

func New

func New(config Config) (*sql.DB, error)

New creates new App from Config

func Ping

func Ping(db *sql.DB) bool

Ping indicate if database is ready or not

func RowsClose

func RowsClose(rows *sql.Rows, err error) error

RowsClose closes rows without shadowing error

Types

type Config

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

Config of package

func Flags

func Flags(fs *flag.FlagSet, prefix string) Config

Flags adds flags for configuring package

Jump to

Keyboard shortcuts

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