Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MySQL ¶
type MySQL struct { DB *gorm.DB // 数据库任务入口 DBUrl string // dbURL 数据库 URL DBUser string // dbUser 数据库用户名 DBPass string // dbPass 数据库用户密码 DBName string // dbName 数据库名称 // LogMode set log mode, `true` for detailed logs, `false` for no log, default, will only print error logs LogModeEnable bool MaxIdleConnects int MaxOpenConnects int // contains filtered or unexported fields }
MySQL sql 连接对象
func (*MySQL) Connect ¶
func (s *MySQL) Connect(dbURL, dbUser, dbPass, dbName string, logModeEnable bool, maxIdleConns, maxOpenConns int) error
Connect 链接数据库服务
dbURL 数据库 URL
dbUser 数据库用户名
dbPass 数据库用户密码
dbName 数据库名称
logModeEnable set log mode, `true` for detailed logs, `false` for no log, default, will only print error logs
SetMaxIdleConns sets the maximum number of connections in the idle connection pool.
SetMaxOpenConns sets the maximum number of open connections to the database.
Click to show internal directories.
Click to hide internal directories.