Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type App ¶
type App struct {
Name string `toml:"name" env:"APP_NAME"`
Host string `toml:"host" env:"APP_HOST"`
Port string `toml:"port" env:"APP_PORT"`
}
func NewDefaultApp ¶
func NewDefaultApp() *App
type Log ¶
type Log struct {
Level string `toml:"level" env:"LOG_LEVEL"`
PathDir string `toml:"path_dir" env:"LOG_PATH_DIR"`
Format LogFormat `toml:"format" env:"LOG_FORMAT"`
To LogTo `toml:"to" env:"LOG_TO"`
}
Log todo
func NewDefaultLog ¶
func NewDefaultLog() *Log
type MySQL ¶
type MySQL struct {
Host string `toml:"host" env:"D_MYSQL_HOST"`
Port string `toml:"port" env:"D_MYSQL_PORT"`
UserName string `toml:"username" env:"D_MYSQL_USERNAME"`
Password string `toml:"password" env:"D_MYSQL_PASSWORD"`
Database string `toml:"database" env:"D_MYSQL_DATABASE"`
// 因为使用的MySQL连接池,需要池做一些规划配置
// 控制当前程序的MySQL打开的连接数
MaxOpenConn int `toml:"max_open_conn" env:"D_MYSQL_MAX_OPEN_CONN"`
// 控制MySQL复用,比如,最多运行5个来复用
MaxIdleConn int `toml:"max_idle_conn" env:"D_MYSQL_MAX_IDLE_CONN"`
// 一个连接的生命周期,这个和MySQL Server配置有关系,必须小于Server配置有关系,必须小于Server配置
// 一个连接用12h,换一个conn, 保证一定的可用性
MaxLifeTime int `toml:"max_life_time" env:"D_MYSQL_MAX_LIFE_TIME"`
// Idle 连接 最多运行存活多久
MaxIdleTime int `toml:"max_idle_time" env:"D_MYSQL_MAX_idle_TIME"`
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.