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