fix: 修复合并后代码质量问题
- 修正 Makefile 迁移目录路径(sqlite3 → sqlite) - 统一 database.go 日志风格(log.Printf → zapLogger) - 修复 config.go validator 标签大小写 - 修复 database_test.go 测试使用 nil logger - 移除未使用的 log 导入
This commit is contained in:
@@ -33,12 +33,12 @@ type ServerConfig struct {
|
||||
// DatabaseConfig 数据库配置
|
||||
type DatabaseConfig struct {
|
||||
Driver string `yaml:"driver" mapstructure:"driver" validate:"required,oneof=sqlite mysql"`
|
||||
Path string `yaml:"path" mapstructure:"path" validate:"required_if=Driver sqlite"`
|
||||
Host string `yaml:"host" mapstructure:"host" validate:"required_if=Driver mysql"`
|
||||
Port int `yaml:"port" mapstructure:"port" validate:"required_if=Driver mysql,min=1,max=65535"`
|
||||
User string `yaml:"user" mapstructure:"user" validate:"required_if=Driver mysql"`
|
||||
Path string `yaml:"path" mapstructure:"path" validate:"required_if=driver sqlite"`
|
||||
Host string `yaml:"host" mapstructure:"host" validate:"required_if=driver mysql"`
|
||||
Port int `yaml:"port" mapstructure:"port" validate:"required_if=driver mysql,min=1,max=65535"`
|
||||
User string `yaml:"user" mapstructure:"user" validate:"required_if=driver mysql"`
|
||||
Password string `yaml:"password" mapstructure:"password"`
|
||||
DBName string `yaml:"dbname" mapstructure:"dbname" validate:"required_if=Driver mysql"`
|
||||
DBName string `yaml:"dbname" mapstructure:"dbname" validate:"required_if=driver mysql"`
|
||||
MaxIdleConns int `yaml:"max_idle_conns" mapstructure:"max_idle_conns" validate:"required,min=1"`
|
||||
MaxOpenConns int `yaml:"max_open_conns" mapstructure:"max_open_conns" validate:"required,min=1"`
|
||||
ConnMaxLifetime time.Duration `yaml:"conn_max_lifetime" mapstructure:"conn_max_lifetime" validate:"required"`
|
||||
|
||||
Reference in New Issue
Block a user