2022-09-09 18:26:08 +08:00
|
|
|
package application
|
|
|
|
|
|
2023-03-06 16:59:57 +08:00
|
|
|
import (
|
|
|
|
|
"mayfly-go/internal/sys/infrastructure/persistence"
|
2024-01-21 22:52:20 +08:00
|
|
|
"mayfly-go/pkg/ioc"
|
2023-03-06 16:59:57 +08:00
|
|
|
)
|
2022-09-09 18:26:08 +08:00
|
|
|
|
2024-01-22 11:35:28 +08:00
|
|
|
func InitIoc() {
|
2024-01-21 22:52:20 +08:00
|
|
|
persistence.Init()
|
|
|
|
|
|
|
|
|
|
ioc.Register(new(accountAppImpl), ioc.WithComponentName("AccountApp"))
|
|
|
|
|
ioc.Register(new(roleAppImpl), ioc.WithComponentName("RoleApp"))
|
|
|
|
|
ioc.Register(new(configAppImpl), ioc.WithComponentName("ConfigApp"))
|
|
|
|
|
ioc.Register(new(resourceAppImpl), ioc.WithComponentName("ResourceApp"))
|
|
|
|
|
ioc.Register(new(syslogAppImpl), ioc.WithComponentName("SyslogApp"))
|
|
|
|
|
}
|
2022-09-09 18:26:08 +08:00
|
|
|
|
|
|
|
|
func GetAccountApp() Account {
|
2024-01-21 22:52:20 +08:00
|
|
|
return ioc.Get[Account]("AccountApp")
|
2022-09-09 18:26:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func GetConfigApp() Config {
|
2024-01-21 22:52:20 +08:00
|
|
|
return ioc.Get[Config]("ConfigApp")
|
2022-09-09 18:26:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func GetResourceApp() Resource {
|
2024-01-21 22:52:20 +08:00
|
|
|
return ioc.Get[Resource]("ResourceApp")
|
2022-09-09 18:26:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func GetRoleApp() Role {
|
2024-01-21 22:52:20 +08:00
|
|
|
return ioc.Get[Role]("RoleApp")
|
2022-09-09 18:26:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func GetSyslogApp() Syslog {
|
2024-01-21 22:52:20 +08:00
|
|
|
return ioc.Get[Syslog]("SyslogApp")
|
2022-09-09 18:26:08 +08:00
|
|
|
}
|