db

package
v0.0.0-...-92f7cd3 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const ConnectionTimeout = time.Duration(30 * time.Second)

ConnectionTimeout is the default timeout for connection

Variables

This section is empty.

Functions

func ConnectLoop

func ConnectLoop(dialect string, dsn string, timeout time.Duration) (*sqlx.DB, error)

ConnectLoop is the func for connection in a loop with timeout

Types

type DB

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

DB is the struct for a DB connection

func New

func New(conf config.DB, logger log.ILogger) (*DB, error)

New creates a new DB connection

func (*DB) Close

func (db *DB) Close() error

Close connection

func (*DB) DB

func (db *DB) DB() *sqlx.DB

DB returns a db object

type IDB

type IDB interface {
	DB() *sqlx.DB
}

IDB is the interface for a DB connection

Jump to

Keyboard shortcuts

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