添加AllModels

This commit is contained in:
eson
2023-06-21 11:29:09 +08:00
parent edeb2bb5f1
commit 389f12b8c5
8 changed files with 143 additions and 28 deletions

View File

@@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"fusenapi/initalize"
"fusenapi/model/gmodel"
"fusenapi/server/home-user-auth/internal/config"
"net/http"
@@ -14,12 +15,14 @@ import (
type ServiceContext struct {
Config config.Config
MysqlConn *gorm.DB
AllModels *gmodel.AllModelsGen
}
func NewServiceContext(c config.Config) *ServiceContext {
return &ServiceContext{
Config: c,
MysqlConn: initalize.InitMysql(c.SourceMysql),
AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)),
}
}