Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var MySQLManager map[string]*MySQLProxy
Functions ¶
func InitMySQLProxys ¶
func InitMySQLProxys(ps []MySQLProxy) (err error)
Types ¶
type MySQLProxy ¶
type MySQLProxy struct {
ProxyName string `json:"proxy_name"`
Username string
Password string
Addr string
Database string
Session *sql.DB
// 连接时设置的参数,参考mysql driver 包的 parseDSNParams 进行添加
ReadTimeoutSec int `json:"read_timeout_sec"`
WriteTimeoutSec int `json:"write_timeout_sec"`
ConnTimeoutSec int `json:"conn_timeout_sec"`
// 建立连接后设置的参数
ConnMaxLifetime int `json:"conn_max_lifetime"` // 设置链接的生命周期
MaxIdleConns int `json:"max_idle_conns"` // 设置闲置链接数
MaxOpenConns int `json:"max_open_conns"` // 设置最大链接数
}
func CreateMySQLProxy ¶
func CreateMySQLProxy(p *MySQLProxy) (proxy *MySQLProxy, err error)
Click to show internal directories.
Click to hide internal directories.