feat: import services and standardize Go 1.26.5
This commit is contained in:
31
apps/base/sender/internal/impl/impl.go
Normal file
31
apps/base/sender/internal/impl/impl.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package impl
|
||||
|
||||
import (
|
||||
"git.apinb.com/bsm-apps/sender/internal/config"
|
||||
"git.apinb.com/bsm-sdk/core/cache/redis"
|
||||
"git.apinb.com/bsm-sdk/core/with"
|
||||
cache "github.com/patrickmn/go-cache"
|
||||
clientv3 "go.etcd.io/etcd/client/v3"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
var (
|
||||
RedisService *redis.RedisClient // Redis 缓存服务客户端
|
||||
EtcdService *clientv3.Client // Etcd 客户端
|
||||
DBService *gorm.DB // 数据库服务
|
||||
MemorySerice *cache.Cache // 内存缓存服务(BigCache)
|
||||
)
|
||||
|
||||
// NewImpl 初始化所有依赖服务(内存、Redis、数据库、Etcd)
|
||||
func NewImpl() {
|
||||
// 初始化内存缓存服务
|
||||
MemorySerice = with.Memory(nil)
|
||||
// 初始化 Redis 缓存服务
|
||||
RedisService = with.RedisCache(config.Spec.Cache)
|
||||
// 初始化数据库服务
|
||||
DBService = with.Databases(config.Spec.Databases, nil)
|
||||
// 初始化 Etcd 客户端
|
||||
EtcdService = with.Etcd(config.Spec.Etcd)
|
||||
// 初始化服务提供商
|
||||
withProvider()
|
||||
}
|
||||
Reference in New Issue
Block a user