增加批量读取配置 TODO : 待完成

This commit is contained in:
2022-06-11 17:49:43 +08:00
parent 9377cd288f
commit e610e02d45
4 changed files with 46 additions and 13 deletions

View File

@ -27,16 +27,6 @@ type DBConfig struct {
Connection Connection `json:"connection" yaml:"connection"` // 连接数量配置
}
// Connection 连接数配置
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 19:05 2022/6/5
type Connection struct {
MaxOpen int `json:"max_open" yaml:"max_open"` // 打开的最大连接数
MaxIdle int `json:"max_idle" yaml:"max_idle"` // 最大空闲连接数
}
// LogConfig 日志配置
//
// Author : go_developer@163.com<白茶清欢>
@ -58,8 +48,9 @@ type LogConfig struct {
//
// Date : 14:47 2022/6/9
type cfgFile struct {
Path string `json:"path"` // 配置文件路径
Type string `json:"type"` // 配置文件类型
Path string `json:"path"` // 配置文件路径
Type string `json:"type"` // 配置文件类型
Config Mysql `json:"config"` // 解析之后的配置文件
}
const (
@ -70,3 +61,39 @@ const (
// FileTypeJson json
FileTypeJson = "json"
)
// Database 数据库配置
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 15:19 2022/6/9
type Database struct {
Master *Mysql `json:"master" yaml:"master"`
Slave *Mysql `json:"slave" yaml:"slave"`
}
// Mysql ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 18:44 2022/5/14
type Mysql struct {
Host string `json:"host" yaml:"host"` // 数据库地址
Port int `json:"port" yaml:"port"` // 数据库端口
Username string `json:"username" yaml:"username"` // 用户名
Password string `json:"password" yaml:"password"` // 密码
Database string `json:"database" yaml:"database"` // 数据库
Charset string `json:"charset" yaml:"charset"` // 数据库编码
Connection *Connection `json:"connection" yaml:"connection"` // 连接配置
LogFileName string `json:"log_file_name" yaml:"log_file_name"` // 日志文件名
}
// Connection 连接数配置
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 15:18 2022/6/9
type Connection struct {
MaxOpen int `json:"max_open" yaml:"max_open"` // 最大打开连接数
MaxIdle int `json:"max_idle" yaml:"max_idle"` // 最大的处理连接数
}