postgresdb

package
v0.0.54 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: Apache-2.0, MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostgresConfig

type PostgresConfig struct {
	Host     string
	Port     string
	User     string
	Password string
	Database string
	SSLMode  string
}

PostgresConfig contains config for postgres connection

func (PostgresConfig) String

func (pgcfg PostgresConfig) String() string

type PostgresDB

type PostgresDB struct {
	*sql.DB
	// contains filtered or unexported fields
}

PostgresDB is a sql.DB with reconnect functionality.

func New

func New(connString string) *PostgresDB

New creates a new PostgresDB instance.

func (*PostgresDB) Connect

func (db *PostgresDB) Connect() error

Connect checks database connection and connects if not connected.

func (*PostgresDB) Name added in v0.0.5

func (db *PostgresDB) Name() string

func (*PostgresDB) RetryableError added in v0.0.5

func (db *PostgresDB) RetryableError(err error) bool

RetryableError determines if a transaction should be retried after failing due to the specified error. When true, sleeps for a short random time before returning.

func (*PostgresDB) SqlDB

func (db *PostgresDB) SqlDB() *sql.DB

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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