2023-06-01 07:32:28 +00:00
|
|
|
package svc
|
|
|
|
|
|
|
|
import (
|
2023-06-12 06:05:35 +00:00
|
|
|
"fusenapi/initalize"
|
2023-06-08 03:03:20 +00:00
|
|
|
"fusenapi/server/product/internal/config"
|
2023-06-12 06:05:35 +00:00
|
|
|
"gorm.io/gorm"
|
2023-06-01 07:32:28 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type ServiceContext struct {
|
2023-06-12 06:05:35 +00:00
|
|
|
Config config.Config
|
|
|
|
|
|
|
|
MysqlConn *gorm.DB
|
2023-06-01 07:32:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewServiceContext(c config.Config) *ServiceContext {
|
|
|
|
return &ServiceContext{
|
2023-06-01 10:34:41 +00:00
|
|
|
Config: c,
|
2023-06-12 06:05:35 +00:00
|
|
|
MysqlConn: initalize.InitMysql(c.SourceMysql),
|
2023-06-01 07:32:28 +00:00
|
|
|
}
|
|
|
|
}
|