Documentation ¶
Index ¶
- Constants
- Variables
- type Config
- type MysqlProvider
- func (mp *MysqlProvider) AssignList(entity dal.QueryEntity, output interface{}) error
- func (mp *MysqlProvider) AssignSingle(entity dal.QueryEntity, output interface{}) error
- func (mp *MysqlProvider) Error(errInfo string) error
- func (mp *MysqlProvider) Exec(entity dal.TranEntity) (result dal.TranResult)
- func (mp *MysqlProvider) ExecTrans(entities []dal.TranEntity) (result dal.TranResult)
- func (mp *MysqlProvider) InitDB(config string) error
- func (mp *MysqlProvider) List(entity dal.QueryEntity) ([]map[string]string, error)
- func (mp *MysqlProvider) Pager(entity dal.QueryEntity) (dal.QueryPagerResult, error)
- func (mp *MysqlProvider) PrintSQL(query string, values ...interface{})
- func (mp *MysqlProvider) Query(entity dal.QueryEntity) (interface{}, error)
- func (mp *MysqlProvider) Single(entity dal.QueryEntity) (map[string]string, error)
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)
Click to show internal directories.
Click to hide internal directories.