fusenapi/server/feishu-sync/internal/svc/servicecontext.go
laodaming ebb7354d23 fix
2023-11-06 14:09:40 +08:00

28 lines
577 B
Go

package svc
import (
"fusenapi/initalize"
"fusenapi/model/gmodel"
"fusenapi/server/feishu-sync/internal/config"
"gorm.io/gorm"
)
type ServiceContext struct {
Config config.Config
MysqlConn *gorm.DB
AllModels *gmodel.AllModelsGen
RabbitMq *initalize.RabbitMqHandle
}
func NewServiceContext(c config.Config) *ServiceContext {
conn := initalize.InitMysql(c.SourceMysql)
return &ServiceContext{
Config: c,
MysqlConn: conn,
AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)),
RabbitMq: initalize.InitRabbitMq(c.SourceRabbitMq, nil),
}
}