fusenapi/goctl_template/api/context.tpl
laodaming 53a3490837 fix
2023-06-12 14:05:35 +08:00

22 lines
347 B
Smarty

package svc
import (
{{.configImport}}
"fusenapi/initalize"
"gorm.io/gorm"
)
type ServiceContext struct {
Config {{.config}}
{{.middleware}}
MysqlConn *gorm.DB
}
func NewServiceContext(c {{.config}}) *ServiceContext {
return &ServiceContext{
Config: c,
MysqlConn: initalize.InitMysql(c.SourceMysql),
{{.middlewareAssignment}}
}
}