mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-12-16 04:36:35 +08:00
feat: 新增简易版ioc
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
package persistence
|
||||
|
||||
import "mayfly-go/internal/redis/domain/repository"
|
||||
|
||||
var (
|
||||
redisRepo repository.Redis = newRedisRepo()
|
||||
import (
|
||||
"mayfly-go/internal/redis/domain/repository"
|
||||
"mayfly-go/pkg/ioc"
|
||||
)
|
||||
|
||||
func GetRedisRepo() repository.Redis {
|
||||
return redisRepo
|
||||
func Init() {
|
||||
ioc.Register(newRedisRepo(), ioc.WithComponentName("RedisRepo"))
|
||||
}
|
||||
|
||||
func GetRedisRepo() repository.Redis {
|
||||
return ioc.Get[repository.Redis]("RedisRepo")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user