2023-06-05 09:56:55 +00:00
|
|
|
package svc
|
|
|
|
|
|
|
|
import (
|
|
|
|
{{.configImport}}
|
2023-06-12 06:05:35 +00:00
|
|
|
"fusenapi/initalize"
|
|
|
|
"gorm.io/gorm"
|
2023-06-05 09:56:55 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type ServiceContext struct {
|
|
|
|
Config {{.config}}
|
|
|
|
{{.middleware}}
|
2023-06-12 06:05:35 +00:00
|
|
|
MysqlConn *gorm.DB
|
2023-06-05 09:56:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewServiceContext(c {{.config}}) *ServiceContext {
|
|
|
|
return &ServiceContext{
|
|
|
|
Config: c,
|
2023-06-12 06:05:35 +00:00
|
|
|
MysqlConn: initalize.InitMysql(c.SourceMysql),
|
2023-06-05 09:56:55 +00:00
|
|
|
{{.middlewareAssignment}}
|
|
|
|
}
|
|
|
|
}
|