Files
mayfly-go/server/internal/sys/infrastructure/persistence/persistence.go

40 lines
1.1 KiB
Go
Raw Normal View History

2022-09-09 18:26:08 +08:00
package persistence
2024-01-21 22:52:20 +08:00
import (
"mayfly-go/internal/sys/domain/repository"
"mayfly-go/pkg/ioc"
2022-09-09 18:26:08 +08:00
)
2024-01-21 22:52:20 +08:00
func Init() {
ioc.Register(newAccountRepo(), ioc.WithComponentName("AccountRepo"))
ioc.Register(newRoleRepo(), ioc.WithComponentName("RoleRepo"))
ioc.Register(newAccountRoleRepo(), ioc.WithComponentName("AccountRoleRepo"))
ioc.Register(newResourceRepo(), ioc.WithComponentName("ResourceRepo"))
ioc.Register(newConfigRepo(), ioc.WithComponentName("ConfigRepo"))
ioc.Register(newSyslogRepo(), ioc.WithComponentName("SyslogRepo"))
}
2022-09-09 18:26:08 +08:00
func GetAccountRepo() repository.Account {
2024-01-21 22:52:20 +08:00
return ioc.Get[repository.Account]("AccountRepo")
2022-09-09 18:26:08 +08:00
}
func GetConfigRepo() repository.Config {
2024-01-21 22:52:20 +08:00
return ioc.Get[repository.Config]("ConfigRepo")
2022-09-09 18:26:08 +08:00
}
func GetResourceRepo() repository.Resource {
2024-01-21 22:52:20 +08:00
return ioc.Get[repository.Resource]("ResourceRepo")
2022-09-09 18:26:08 +08:00
}
func GetRoleRepo() repository.Role {
2024-01-21 22:52:20 +08:00
return ioc.Get[repository.Role]("RoleRepo")
2022-09-09 18:26:08 +08:00
}
func GetAccountRoleRepo() repository.AccountRole {
2024-01-21 22:52:20 +08:00
return ioc.Get[repository.AccountRole]("AccountRoleRepo")
}
2022-09-09 18:26:08 +08:00
func GetSyslogRepo() repository.Syslog {
2024-01-21 22:52:20 +08:00
return ioc.Get[repository.Syslog]("SyslogRepo")
2022-09-09 18:26:08 +08:00
}