完成AllModels序列化

This commit is contained in:
eson
2023-06-21 12:21:56 +08:00
parent 389f12b8c5
commit 7fe53f749e
9 changed files with 260 additions and 34 deletions

View File

@@ -2,17 +2,22 @@ package svc
import (
{{.configImport}}
"errors"
"fmt"
"net/http"
"fusenapi/initalize"
"fusenapi/model/gmodel"
"gorm.io/gorm"
"github.com/golang-jwt/jwt"
"net/http"
"errors"
)
type ServiceContext struct {
Config {{.config}}
{{.middleware}}
MysqlConn *gorm.DB
AllModels *gmodel.AllModelsGen
}
func NewServiceContext(c {{.config}}) *ServiceContext {
@@ -20,6 +25,7 @@ func NewServiceContext(c {{.config}}) *ServiceContext {
return &ServiceContext{
Config: c,
MysqlConn: initalize.InitMysql(c.SourceMysql),
AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)),
{{.middlewareAssignment}}
}
}