Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewEngineGroup ¶
func NewEngineGroup(masterEngine *xorm.Engine, slave1Engine ...*xorm.Engine) (*xorm.EngineGroup, error)
======================读写分离设置================== NewEngineGroup 设置读写分离db engine slaveEngine可以多个 返回读写分离的db engine
Types ¶
type DbConf ¶
type DbConf struct {
Ip string
Port int
User string
Password string
Database string
Charset string //字符集 utf8mb4 支持表情符号
Collation string //整理字符集 utf8mb4_unicode_ci
MaxIdleConns int //空闲pool个数
MaxOpenConns int //最大open connection个数
ParseTime bool
Loc string //时区字符串 Local,PRC
SqlCmd bool //sql语句是否输出到终端,true输出到终端
UsePool bool //当前db实例是否采用db连接池,默认不采用,如采用请求配置该参数
ShowExecTime bool //是否打印sql执行时间
}
mysql连接信息 parseTime=true changes the output type of DATE and DATETIME values to time.Time instead of []byte / string The date or datetime like 0000-00-00 00:00:00 is converted into zero value of time.Time.
func (*DbConf) SetEngineName ¶
SetEngineName 给当前数据库指定engineName 一般用在多个db 数据库连接引擎的时候,可以给当前的db engine设置一个name 这样业务上游层,就可以通过 GetEngine(name)获得当前db engine
Click to show internal directories.
Click to hide internal directories.