Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DB *gorm.DB
Functions ¶
func DBConnect ¶
func DBConnect(DBConnConfigurator DataBaseConnConfigurator) error
Types ¶
type DataBaseConnConfigurator ¶
type DataBaseConnConfigurator struct {
DBConnectString string //连接字符串
MaxIdleConns int //空闲连接池中连接的最大数量
MaxOpenConns int //打开数据库连接的最大数量
ConnMaxLifetime int //连接可复用的最大时间(分钟)
SlowThreshold int64 //慢SQL阈值(秒)
LogLevel int //日志级别 1:Silent 2:Error 3:Warn 4:Info
IgnoreRecordNotFoundError bool //忽略ErrRecordNotFound(记录未找到)错误
Colorful bool //使用彩色打印
}
Click to show internal directories.
Click to hide internal directories.