database

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: May 11, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package database provides support for access the database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnString added in v0.3.3

func ConnString(cfg Config) string

ConnString translates the config to a db connection string.

func StatusCheck

func StatusCheck(ctx context.Context, db *DB) error

StatusCheck returns nil if it can successfully talk to the database. It returns a non-nil error otherwise.

Types

type Config

type Config struct {
	User         string
	Password     string
	Host         string
	Name         string
	DisableTLS   bool
	MaxIdleConns int
	MaxOpenConns int
}

Config is the required properties to use the database.

type DB added in v0.3.3

type DB struct {
	*pgxpool.Pool
}

func Connect added in v0.3.3

func Connect(ctx context.Context, cfg Config) (*DB, error)

Connect establishes a database connection based on the configuration.

Jump to

Keyboard shortcuts

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