22 lines
432 B
Go
22 lines
432 B
Go
package lightCore
|
|
|
|
import (
|
|
"code.zhecent.com/gopkg/light-core/pkg/myGorm"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
var DBEngine *gorm.DB
|
|
|
|
func InitDB() {
|
|
orm := myGorm.NewSimpleORM(
|
|
ConfigValue.Database.User,
|
|
ConfigValue.Database.Password,
|
|
ConfigValue.Database.Host,
|
|
ConfigValue.Database.Name,
|
|
ConfigValue.Database.Charset,
|
|
ConfigValue.Server.RunMode,
|
|
)
|
|
orm.SetLoggerLevel(ConfigValue.Database.LogLevel)
|
|
DBEngine = orm.ConnectMysql()
|
|
}
|