pgsql

package
v0.0.0-...-d6bd8d2 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotInited error = errors.New("pgsql: Sql is not initialized!")
	ErrNotConfig       = errors.New("pgsql: Sql is not register!")
)
View Source
var (
	ErrTxLock   error = errors.New("pgsql: error lock sql tx")
	ErrTxUnLock       = errors.New("pgsql: error unlock sql tx")
)

Functions

func NewDataBase

func NewDataBase(c *Config) (*sqlx.DB, error)

Types

type Config

type Config struct {
	Host         string
	Port         string
	Username     string
	Password     string
	DBName       string
	SSL          bool
	MaxIdleConns int
	MaxOpenConns int
}

func NewConfig

func NewConfig(host, port, username, password, dbname string, ssl bool) *Config

func NewFullConfig

func NewFullConfig(host, port, username, password, dbname string, ssl bool, idle, open int) *Config

func (*Config) CloseSSl

func (s *Config) CloseSSl() *Config

func (*Config) OpenSSl

func (s *Config) OpenSSl() *Config

type DB

type DB struct {
	sqlx.DB
	DBMutex
}

func NewDB

func NewDB(c *Config) *DB

func (*DB) BeginX

func (db *DB) BeginX(tx *sqlx.Tx) (*Tx, error)

type DBMutex

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

type Tx

type Tx struct {
	sqlx.Tx
	// contains filtered or unexported fields
}

func (*Tx) Commit

func (tx *Tx) Commit() error

func (*Tx) GetTx

func (tx *Tx) GetTx() *sqlx.Tx

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Jump to

Keyboard shortcuts

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