dbmagic

package
v0.0.0-...-842eef1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2016 License: MIT Imports: 3 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingDatabaseName = errors.New(`Missing database name.`)
	ErrSockerHost          = errors.New(`Can not setting socket and host both.`)
	ErrNotTransaction      = errors.New(`Is not a Transaction can not commit.`)
)

Functions

This section is empty.

Types

type DataSource

type DataSource struct {
	Host         string
	Port         int
	User         string
	Password     string
	Socket       string
	Charset      string
	DatabaseName string
}

type DbMagic

type DbMagic struct {
	Db *sql.DB
	Tx *sql.Tx
}

func Open

func Open(driverName string, settings *DataSource) (*DbMagic, error)

func (*DbMagic) Begin

func (dbm *DbMagic) Begin() error

func (*DbMagic) Close

func (dbm *DbMagic) Close() error

func (*DbMagic) Commit

func (dbm *DbMagic) Commit() error

func (*DbMagic) Exec

func (dbm *DbMagic) Exec(query string, args ...interface{}) (sql.Result, error)

func (*DbMagic) Query

func (dbm *DbMagic) Query(query string, args ...interface{}) (*sql.Rows, error)

func (*DbMagic) QueryRow

func (dbm *DbMagic) QueryRow(query string, args ...interface{}) *sql.Row

func (*DbMagic) Rollback

func (dbm *DbMagic) Rollback() error

Jump to

Keyboard shortcuts

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