feat: 新增简易版ioc

This commit is contained in:
meilin.huang
2024-01-21 22:52:20 +08:00
parent f4a64b96a9
commit f27d3d200f
106 changed files with 815 additions and 707 deletions

View File

@@ -2,13 +2,15 @@ package application
import (
"mayfly-go/internal/mongo/infrastructure/persistence"
tagapp "mayfly-go/internal/tag/application"
"mayfly-go/pkg/ioc"
)
var (
mongoApp Mongo = newMongoAppImpl(persistence.GetMongoRepo(), tagapp.GetTagTreeApp())
)
func init() {
persistence.Init()
ioc.Register(new(mongoAppImpl), ioc.WithComponentName("MongoApp"))
}
func GetMongoApp() Mongo {
return mongoApp
return ioc.Get[Mongo]("MongoApp")
}