feat 初始化

This commit is contained in:
2026-10-29 10:12:22 +08:00
parent 332d812347
commit 09c1df8a22
81 changed files with 2211 additions and 7821 deletions

View File

@@ -4,6 +4,7 @@ import (
"git.hlsq.asia/alex/service-common/config"
"git.hlsq.asia/alex/service-common/db/etcd"
"git.hlsq.asia/alex/service-common/db/kafka"
"git.hlsq.asia/alex/service-common/db/mongo"
"git.hlsq.asia/alex/service-common/db/mysql"
"git.hlsq.asia/alex/service-common/db/redis"
"git.hlsq.asia/alex/service-common/log"
@@ -41,6 +42,12 @@ func (m *DB) Init() error {
return err
}
}
// MONGO
if m.Cfg.Mongo != nil {
if err := mongo.Init(m.Cfg.Mongo); err != nil {
return err
}
}
return nil
}
@@ -57,5 +64,8 @@ func (m *DB) Stop() error {
if err := kafka.Close(); err != nil {
log.Errorf("close kafka failed: %v", err)
}
if err := mongo.Close(); err != nil {
log.Errorf("close mongo failed: %v", err)
}
return nil
}