fusenapi/server/data-transfer/internal/svc/servicecontext.go

21 lines
340 B
Go
Raw Normal View History

2023-06-07 11:47:45 +00:00
package svc
import (
2023-06-12 06:05:35 +00:00
"fusenapi/initalize"
"fusenapi/server/data-transfer/internal/config"
"gorm.io/gorm"
2023-06-07 11:47:45 +00:00
)
type ServiceContext struct {
2023-06-12 06:05:35 +00:00
Config config.Config
2023-06-07 11:47:45 +00:00
2023-06-12 06:05:35 +00:00
MysqlConn *gorm.DB
2023-06-07 11:47:45 +00:00
}
2023-06-12 06:05:35 +00:00
func NewServiceContext(c config.Config) *ServiceContext {
2023-06-07 11:47:45 +00:00
return &ServiceContext{
Config: c,
2023-06-12 06:05:35 +00:00
MysqlConn: initalize.InitMysql(c.SourceMysql),
2023-06-07 11:47:45 +00:00
}
}