feat mysql

This commit is contained in:
2025-12-18 18:17:41 +08:00
parent da91cff056
commit 55c5d4cc18
44 changed files with 1460 additions and 338 deletions

View File

@@ -6,29 +6,41 @@ type AppConfig struct {
type LogConfig struct {
Debug bool `yaml:"debug"`
MaxSize int `yaml:"maxSize"`
MaxBackups int `yaml:"maxBackups"`
MaxAge int `yaml:"maxAge"`
MaxSize int32 `yaml:"maxSize"`
MaxBackups int32 `yaml:"maxBackups"`
MaxAge int32 `yaml:"maxAge"`
Level string `yaml:"level"`
}
type MonitorConfig struct {
Prometheus *struct {
Address string `yaml:"address"`
Port int `yaml:"port"`
Port int32 `yaml:"port"`
} `yaml:"prometheus"`
}
type DBConfig struct {
Etcd *struct {
Address []string `yaml:"address"`
} `yaml:"etcd"`
Etcd *EtcdConfig `yaml:"etcd"`
MySQL map[string]*MySQLConfig `yaml:"mysql"`
}
type EtcdConfig struct {
Endpoints []string `yaml:"endpoints"`
}
type MySQLConfig struct {
Dsn string `yaml:"dsn"`
MaxOpenConn int32 `yaml:"max_open_conn"`
MaxIdleConn int32 `yaml:"max_idle_conn"`
ConnMaxLifetimeSec int32 `yaml:"conn_max_lifetime_sec"`
ConnMaxIdleTimeSec int32 `yaml:"conn_max_idle_time_sec"`
LogLevel string `yaml:"log_level"`
}
type ServeConfig struct {
Grpc *struct {
Address string `yaml:"address"`
Port int `yaml:"port"`
Port int32 `yaml:"port"`
TTL int64 `yaml:"ttl"`
} `yaml:"grpc"`
Socket *struct {
@@ -40,5 +52,5 @@ type ServeConfig struct {
type AddressConfig struct {
Address string `yaml:"address"`
Port int `yaml:"port"`
Port int32 `yaml:"port"`
}