db

package module
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PerformExec

func PerformExec(dbConn *sqlx.DB, query string, params ...interface{}) (result sql.Result, err error)

func PerformGet

func PerformGet(dbConn *sqlx.DB, result interface{}, query string, params ...interface{}) (empty bool, err error)

func PerformSelect

func PerformSelect(dbConn *sqlx.DB, result interface{}, query string, params ...interface{}) (empty bool, err error)

Types

type DbConf

type DbConf struct {
	Username string
	Password string
	Database string
	Host     string
	Port     int
}

DbConf holds the database configuration information.

func NewDbConf

func NewDbConf(username string, password string, host string, port int, database string) *DbConf

NewDbConf creates a new DbConf with the prerequisite information.

func (*DbConf) UpdateHostAndPort

func (c *DbConf) UpdateHostAndPort(mappedHost string, mappedPort int) *DbConf

Mapped adds the host and port mapped by a container.

type Option added in v0.2.1

type Option func(*PostgresConnection)

Option -.

func MaxPoolSize added in v0.2.1

func MaxPoolSize(size int) Option

MaxPoolSize -.

type PostgresConnection

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

func New added in v0.2.1

func New(conf DbConf, opts ...Option) *PostgresConnection

func (*PostgresConnection) CloseConnection

func (p *PostgresConnection) CloseConnection()

func (*PostgresConnection) Connection added in v0.2.2

func (p *PostgresConnection) Connection() *sql.DB

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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