connection

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDatabaseToPool

func AddDatabaseToPool(name string, DB *sqlx.DB)

AddDatabaseToPool add connection to pool

func Get

func Get() (*sqlx.DB, error)

Get get postgres connection

func GetDatabase

func GetDatabase() string

GetDatabase get current database in use

func GetFromPool

func GetFromPool(dbName string) (*sqlx.DB, error)

GetFromPool tries to get the db name from the db pool will return error if not found

func GetURI

func GetURI(DBName string) string

GetURI postgres connection URI

func MustGet

func MustGet() *sqlx.DB

MustGet get postgres connection

func SetDatabase

func SetDatabase(name string)

SetDatabase set current database in use

Types

type Pool

type Pool struct {
	Mtx *sync.Mutex
	DB  map[string]*sqlx.DB
}

Pool struct

func GetPool

func GetPool() *Pool

GetPool of connection

Jump to

Keyboard shortcuts

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