mysql

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2016 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMaxOpenConns    = 0
	DefaultMaxIdleConns    = 500
	DefaultConnMaxLifetime = time.Hour * 2
)

Variables

View Source
var (
	GDB *sql.DB
)

Functions

This section is empty.

Types

type Config

type Config struct {
	// DataSource 数据库连接
	DataSource string `json:"datasource"`
	// MaxOpenConns 打开最大连接数
	MaxOpenConns int `json:"maxopen"`
	// MaxIdleConns 连接池保持连接数量
	MaxIdleConns int `json:"maxidle"`
	// ConnMaxLifetime 连接池的生命周期
	ConnMaxLifetime time.Duration `json:"maxlifetime"`
	// IsPrint 是否打印SQL
	IsPrint bool `json:"print"`
}

type MysqlProvider

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

func (*MysqlProvider) AssignList

func (mp *MysqlProvider) AssignList(entity dal.QueryEntity, output interface{}) error

func (*MysqlProvider) AssignSingle

func (mp *MysqlProvider) AssignSingle(entity dal.QueryEntity, output interface{}) error

func (*MysqlProvider) Error

func (mp *MysqlProvider) Error(errInfo string) error

func (*MysqlProvider) Exec

func (mp *MysqlProvider) Exec(entity dal.TranEntity) (result dal.TranResult)

func (*MysqlProvider) ExecTrans

func (mp *MysqlProvider) ExecTrans(entities []dal.TranEntity) (result dal.TranResult)

func (*MysqlProvider) InitDB

func (mp *MysqlProvider) InitDB(config string) error

func (*MysqlProvider) List

func (mp *MysqlProvider) List(entity dal.QueryEntity) ([]map[string]string, error)

func (*MysqlProvider) Pager

func (mp *MysqlProvider) Pager(entity dal.QueryEntity) (dal.QueryPagerResult, error)

func (*MysqlProvider) PrintSQL

func (mp *MysqlProvider) PrintSQL(query string, values ...interface{})

func (*MysqlProvider) Query

func (mp *MysqlProvider) Query(entity dal.QueryEntity) (interface{}, error)

func (*MysqlProvider) Single

func (mp *MysqlProvider) Single(entity dal.QueryEntity) (map[string]string, error)

Jump to

Keyboard shortcuts

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