init
This commit is contained in:
15
config/db.go
Normal file
15
config/db.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package config
|
||||
|
||||
type DbConf struct {
|
||||
DbHost string `mapstructure:"db_host" json:"db_host" yaml:"db_host"`
|
||||
DbPort int `mapstructure:"db_port" json:"db_port" yaml:"db_port"`
|
||||
DbName string `mapstructure:"db_name" json:"db_name" yaml:"db_name"`
|
||||
DbUser string `mapstructure:"db_user" json:"db_user" yaml:"db_user"`
|
||||
DbPass string `mapstructure:"db_pass" json:"db_pass" yaml:"db_pass"`
|
||||
TablePrefix string `mapstructure:"table_prefix" json:"table_prefix" yaml:"table_prefix"`
|
||||
TimeZone string `mapstructure:"time_zone" json:"time_zone" yaml:"time_zone"`
|
||||
LogLevel int `mapstructure:"log_level" json:"log_level" yaml:"log_level"` // LogLevel SQL日志级别 (1-静音 2-错误 3-警告 4-信息)
|
||||
SlowThreshold int `mapstructure:"slow_threshold" json:"slow_threshold" yaml:"slow_threshold"` // SlowThreshold 慢SQL阈值(毫秒)。慢SQL会在log_level大于等于3时输出。
|
||||
IdleConns int `mapstructure:"idle_conns" json:"idle_conns" yaml:"idle_conns"` // 空闲连接池中的最大连接数,建议为open_conns的百分之5-20之间
|
||||
OpenConns int `mapstructure:"open_conns" json:"open_conns" yaml:"open_conns"` // 最大打开连接数,建议这里设置为50
|
||||
}
|
||||
Reference in New Issue
Block a user