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

55 lines
1.8 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/db/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(newInstanceRepo(), ioc.WithComponentName("DbInstanceRepo"))
ioc.Register(newDbRepo(), ioc.WithComponentName("DbRepo"))
ioc.Register(newDbSqlRepo(), ioc.WithComponentName("DbSqlRepo"))
ioc.Register(newDbSqlExecRepo(), ioc.WithComponentName("DbSqlExecRepo"))
ioc.Register(newDataSyncTaskRepo(), ioc.WithComponentName("DbDataSyncTaskRepo"))
ioc.Register(newDataSyncLogRepo(), ioc.WithComponentName("DbDataSyncLogRepo"))
ioc.Register(NewDbBackupRepo(), ioc.WithComponentName("DbBackupRepo"))
ioc.Register(NewDbBackupHistoryRepo(), ioc.WithComponentName("DbBackupHistoryRepo"))
ioc.Register(NewDbRestoreRepo(), ioc.WithComponentName("DbRestoreRepo"))
ioc.Register(NewDbRestoreHistoryRepo(), ioc.WithComponentName("DbRestoreHistoryRepo"))
ioc.Register(NewDbBinlogRepo(), ioc.WithComponentName("DbBinlogRepo"))
ioc.Register(NewDbBinlogHistoryRepo(), ioc.WithComponentName("DbBinlogHistoryRepo"))
2024-01-21 22:52:20 +08:00
}
2023-08-27 11:07:29 +08:00
func GetInstanceRepo() repository.Instance {
2024-01-21 22:52:20 +08:00
return ioc.Get[repository.Instance]("DbInstanceRepo")
2023-08-27 11:07:29 +08:00
}
2022-09-09 18:26:08 +08:00
func GetDbRepo() repository.Db {
2024-01-21 22:52:20 +08:00
return ioc.Get[repository.Db]("DbRepo")
2022-09-09 18:26:08 +08:00
}
func GetDbSqlRepo() repository.DbSql {
2024-01-21 22:52:20 +08:00
return ioc.Get[repository.DbSql]("DbSqlRepo")
2022-09-09 18:26:08 +08:00
}
func GetDbSqlExecRepo() repository.DbSqlExec {
2024-01-21 22:52:20 +08:00
return ioc.Get[repository.DbSqlExec]("DbSqlExecRepo")
2022-09-09 18:26:08 +08:00
}
2023-12-27 22:59:20 +08:00
func GetDbBackupHistoryRepo() repository.DbBackupHistory {
2024-01-21 22:52:20 +08:00
return ioc.Get[repository.DbBackupHistory]("DbBackupHistoryRepo")
2023-12-27 22:59:20 +08:00
}
func GetDbRestoreHistoryRepo() repository.DbRestoreHistory {
2024-01-21 22:52:20 +08:00
return ioc.Get[repository.DbRestoreHistory]("DbRestoreHistoryRepo")
2023-12-27 22:59:20 +08:00
}
func GetDataSyncLogRepo() repository.DataSyncLog {
2024-01-21 22:52:20 +08:00
return ioc.Get[repository.DataSyncLog]("DataSyncLogRepo")
}
func GetDataSyncTaskRepo() repository.DataSyncTask {
2024-01-21 22:52:20 +08:00
return ioc.Get[repository.DataSyncTask]("DataSyncTaskRepo")
}