This commit is contained in:
hailin 2025-06-22 10:44:01 +08:00
parent 6693a47c2d
commit 69052faa7a
2 changed files with 21 additions and 19 deletions

View File

@ -33,7 +33,8 @@ type Controller struct {
func NewController(cfg *config.Config) *Controller {
var err error
var my, pg *sqlca.Engine
//var my, pg *sqlca.Engine
var my *sqlca.Engine
my, err = sqlca.NewEngine(cfg.DSN)
if err != nil {
log.Panic("MySQL source [%s] connect error [%s]", cfg.DSN, err.Error())
@ -41,22 +42,22 @@ func NewController(cfg *config.Config) *Controller {
}
my.Debug(cfg.Debug) //SQL调试日志
my.SlowQuery(true, 800) //慢查询告警
pg, err = sqlca.NewEngine(cfg.Postgresql)
if err != nil {
log.Panic(" Postgresql source [%s] connect error [%s]", cfg.Postgresql, err.Error())
return nil
}
pg.Debug(cfg.Debug) //SQL调试日志
pg.SlowQuery(true, 800) //慢查询告警
// pg, err = sqlca.NewEngine(cfg.Postgresql)
// if err != nil {
// log.Panic(" Postgresql source [%s] connect error [%s]", cfg.Postgresql, err.Error())
// return nil
// }
// pg.Debug(cfg.Debug) //SQL调试日志
// pg.SlowQuery(true, 800) //慢查询告警
return &Controller{
cfg: cfg,
BizCore: core.NewBizCore(cfg, my),
CommonCore: core.NewCommonCore(cfg, my),
PlatformCore: core.NewPlatformCore(cfg, my),
CustomerCore: core.NewCustomerCore(cfg, my),
DeployCore: core.NewDeployCore(cfg, my),
GatewayCore: core.NewGatewayCore(cfg, my),
SchedulerCore: core.NewSchedulerCore(cfg, my, pg),
cfg: cfg,
BizCore: core.NewBizCore(cfg, my),
CommonCore: core.NewCommonCore(cfg, my),
PlatformCore: core.NewPlatformCore(cfg, my),
CustomerCore: core.NewCustomerCore(cfg, my),
DeployCore: core.NewDeployCore(cfg, my),
GatewayCore: core.NewGatewayCore(cfg, my),
//SchedulerCore: core.NewSchedulerCore(cfg, my, pg),
DeployProgressPool: ws.NewWebSocketPool(),
}
}

View File

@ -1,15 +1,16 @@
package core
import (
"github.com/civet148/log"
"github.com/civet148/sqlca/v2"
"github.com/go-co-op/gocron"
"intent-system/pkg/config"
"intent-system/pkg/dal/dao"
"intent-system/pkg/dal/models"
"intent-system/pkg/email"
"intent-system/pkg/utils"
"time"
"github.com/civet148/log"
"github.com/civet148/sqlca/v2"
"github.com/go-co-op/gocron"
)
const (