1234567891011121314151617181920212223242526 |
- package config
- var (
- _mysqlConfig *MySQLConfig
- )
- type MySQLConfig struct {
- UserName string `yaml:"user,omitempty"`
- Pwd string `yaml:"pwd,omitempty"`
- Host string `yaml:"host,omitempty"`
- Port int `yaml:"port,omitempty"`
- DB string `yaml:"name,omitempty"`
- CharSet string `yaml:"character,omitempty"`
- MaxIdleCon int `yaml:"max_idle_con,omitempty"`
- MaxOpenCon int `yaml:"max_open_con,omitempty"`
- }
- func InitMySQL(path string) {
- var config MySQLConfig
- readConfig(path, &config)
- _mysqlConfig = &config
- }
- func GetMySQLConfig() MySQLConfig {
- return *_mysqlConfig
- }
|