Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Db ¶
type Db struct {
Type string `mapstructure:"type" json:"type" yaml:"type"` // 数据库类型:mysql,mssql,pgsql,oracle
AliasName string `mapstructure:"alias-name" json:"alias-name" yaml:"alias-name"` // 数据库别名,用于区分和获取数据库
DbName string `mapstructure:"db-name" json:"db-name" yaml:"db-name"` // 数据库名
Path string `mapstructure:"path" json:"path" yaml:"path"` // 数据库地址
Port string `mapstructure:"port" json:"port" yaml:"port"` // 数据库端口
Config string `mapstructure:"config" json:"config" yaml:"config"` // 高级配置
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全局日志
LogZap bool `mapstructure:"log-zap" json:"log-zap" yaml:"log-zap"` // 是否通过zap写入日志文件
}
type Log ¶
type Log struct {
Name string `mapstructure:"name" json:"name" yaml:"name"` // 日志类型:system...
Directory string `mapstructure:"directory" json:"directory" yaml:"directory"` // 日志保存目录
MaxSize int `mapstructure:"max_size" json:"max_size" yaml:"max_size"`
MaxAge int `mapstructure:"max_age" json:"max_age" yaml:"max_age"`
MaxBackups int `mapstructure:"max_backups" json:"max_backups" yaml:"max_backups"`
}
Click to show internal directories.
Click to hide internal directories.