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