database

package
v0.0.0-...-6362154 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDatabaseDown = errors.New("database down")

Functions

This section is empty.

Types

type Db

type Db struct {
	Once       *sync.Once
	Ctx        *context.Context
	ReopenConn chan bool
	IsWaiting  bool

	Conn *pgxpool.Pool
	// contains filtered or unexported fields
}

func New

func New(ctx *context.Context) *Db

func (*Db) Connect

func (db *Db) Connect() (err error)

func (*Db) Exec

func (db *Db) Exec(sql string, args ...interface{}) (pgconn.CommandTag, error)

func (*Db) LoopCheckConnection

func (db *Db) LoopCheckConnection()

func (*Db) Query

func (db *Db) Query(sql string, args ...interface{}) (pgx.Rows, error)

func (*Db) QueryFunc

func (db *Db) QueryFunc(sql string, args []interface{}, scans []interface{}, f func(pgx.QueryFuncRow) error) (pgconn.CommandTag, error)

func (*Db) QueryRow

func (db *Db) QueryRow(sql string, args ...interface{}) (pgx.Row, error)

func (*Db) Reconnect

func (db *Db) Reconnect()

func (*Db) WaitForConnection

func (db *Db) WaitForConnection()

Jump to

Keyboard shortcuts

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