feat: 支持db_path, 适配 sqlite3 的数据库文件

This commit is contained in:
2025-12-31 16:12:53 +08:00
parent 8004cbb02c
commit 3f564974db
3 changed files with 3 additions and 46 deletions

View File

@@ -53,6 +53,7 @@ type Database struct {
// Date : 18:44 2022/5/14
type Driver struct {
DBType string `json:"db_type" yaml:"db_type" toml:"db_type" ini:"db_type"` // 数据库驱动类型
DBPath string `json:"db_path" yaml:"db_path" toml:"db_path" ini:"db_path"` // sqlite 数据库文件路径
Host string `json:"host" yaml:"host" toml:"host" ini:"host"` // 数据库地址
Port int `json:"port" yaml:"port" toml:"port" ini:"port"` // 数据库端口
Username string `json:"username" yaml:"username" toml:"username" ini:"username"` // 用户名
@@ -64,35 +65,23 @@ type Driver struct {
}
// Connection 连接数配置
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 15:18 2022/6/9
type Connection struct {
MaxOpen int `json:"max_open" yaml:"max_open" toml:"max_open" ini:"max_open"` // 最大打开连接数
MaxIdle int `json:"max_idle" yaml:"max_idle" toml:"max_idle" ini:"max_idle"` // 最大的处理连接数
}
// DescTableItem 表结构的描述
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 22:45 2023/8/16
type DescTableItem struct {
Default *string `json:"Default"` // 默认值
Extra string `json:"Extra"` // 扩展信息
Field string `json:"field"` // 字段名
Key string `json:"Key"` // 索引信息
Null string `json:"Null"` // 是否允许为NUll
Null string `json:"Null"` // 是否允许为 NUll
Type string `json:"Type"` // 字段类型
Comment string `json:"Comment"` // 字段注释
}
// ColumnInfo 表字段结构,INFORMATION_SCHEMA.COLUMNS 标的查询结果
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 23:00 2023/8/16
type ColumnInfo struct {
TableCatalog string `json:"TABLE_CATALOG" gorm:"column:TABLE_CATALOG;default:;NOT NULL"` // TABLE_CATALOG
TableSchema string `json:"TABLE_SCHEMA" gorm:"column:TABLE_SCHEMA;default:;NOT NULL"` // TABLE_SCHEMA