Develop init (#1280)

* 修改数据库初始化方式,增加引擎配置、统一表前缀、是否关闭复数表名

* 修改拦截器逻辑,develop模式不走数据库权限验证

* 增加表前缀,复数表,数据库引擎配置。

Co-authored-by: 吴璟 <hypf2008@126.com>
This commit is contained in:
奇淼(piexlmax
2022-11-10 12:08:13 +08:00
committed by GitHub
parent 4ebe66a29c
commit 9dacd7056b
9 changed files with 59 additions and 28 deletions

View File

@@ -15,6 +15,9 @@ type GeneralDB struct {
Dbname string `mapstructure:"db-name" json:"db-name" yaml:"db-name"` // 数据库名
Username string `mapstructure:"username" json:"username" yaml:"username"` // 数据库用户名
Password string `mapstructure:"password" json:"password" yaml:"password"` // 数据库密码
Prefix string `mapstructure:"prefix" json:"prefix" yaml:"prefix"` //全局表前缀单独定义TableName则不生效
Singular bool `mapstructure:"singular" json:"singular" yaml:"singular"` //是否开启全局禁用复数true表示开启
Engine string `mapstructure:"engine" json:"engine" yaml:"engine" default:"InnoDB"` //数据库引擎默认InnoDB
MaxIdleConns int `mapstructure:"max-idle-conns" json:"max-idle-conns" yaml:"max-idle-conns"` // 空闲中的最大连接数
MaxOpenConns int `mapstructure:"max-open-conns" json:"max-open-conns" yaml:"max-open-conns"` // 打开到数据库的最大连接数
LogMode string `mapstructure:"log-mode" json:"log-mode" yaml:"log-mode"` // 是否开启Gorm全局日志