mysqlx

package
v0.0.0-...-cd938e1 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MysqlConf

type MysqlConf struct {
	User   string `yaml:"user" json:"user"`
	Passwd string `yaml:"passwd" json:"passwd"`
	Addr   string `yaml:"addr" json:"addr"`
	DBName string `yaml:"dbName" json:"dbName"`

	// sql.DB#SetMaxOpenConns()
	MaxOpenConns int `yaml:"maxOpenConns" json:"maxOpenConns"`
	// sql.DB#SetMaxIdleConns()
	MaxIdleConns int `yaml:"maxIdleConns" json:"maxIdleConns"`
	// sql.DB#SetConnMaxLifetime() 填写
	// 填写规则同time.Duration:1s , 1m , 1h
	ConnMaxLifetime time.Duration `yaml:"connMaxLifetime" json:"connMaxLifetime"`
}

MysqlConf mysql配置

func (MysqlConf) MustConnect

func (c MysqlConf) MustConnect() *sql.DB

MustConnect 连接 阿里云实例最大连接数,一般4000左右

func (MysqlConf) ToDSN

func (c MysqlConf) ToDSN() string

ToDSN 转换为dsn

Jump to

Keyboard shortcuts

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