feat:完善项目
This commit is contained in:
32
app/common/model/model_test.go
Normal file
32
app/common/model/model_test.go
Normal file
@ -0,0 +1,32 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
GormEngine "github.com/belief428/gorm-engine"
|
||||
"github.com/belief428/gorm-engine/engine"
|
||||
"github.com/belief428/gorm-engine/logic"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
var (
|
||||
_db *gorm.DB
|
||||
)
|
||||
|
||||
func mysql() logic.IEngine {
|
||||
return &engine.MConfig{
|
||||
User: "appuser", Password: "ABCabc01!",
|
||||
Host: "192.168.99.188", Port: 3306,
|
||||
DBName: "iot", Parameters: "charset=utf8mb4,utf8&parseTime=True&loc=Asia%2FShanghai",
|
||||
}
|
||||
}
|
||||
|
||||
func _init() {
|
||||
_db = GormEngine.NewEngine()(1, &GormEngine.EngineConfig{
|
||||
Debug: true,
|
||||
TablePrefix: "",
|
||||
Complex: false,
|
||||
MaxIdleConns: 50,
|
||||
MaxOpenConns: 150,
|
||||
MaxLifetime: 3600,
|
||||
}).Start(mysql())
|
||||
}
|
Reference in New Issue
Block a user