mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-23 01:20:25 +08:00
feat: 新增简易版ioc
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user