package impl

import (
	"bsm/full/module/base/passport/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
	EtcdService   *clientv3.Client
	DBService     *gorm.DB
	MemoryService *cache.Cache
)

func NewImpl() {
	// with memory cache
	MemoryService = with.Memory(nil)
	// with redis cache
	RedisService = with.RedisCache(config.Spec.Cache)
	// with databases
	DBService = with.Databases(config.Spec.Databases, nil)
	// with etcd
	EtcdService = with.Etcd(config.Spec.Etcd)
}
