Files
elevator-server/config/db.go
2024-12-23 18:34:46 +08:00

16 lines
1.3 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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
}