mirror of
https://gitee.com/dromara/mayfly-go
synced 2026-01-06 22:55:46 +08:00
refactor: code review、数据库备份恢复支持ssh隧道操作
This commit is contained in:
@@ -73,6 +73,11 @@ func (app *DbRestoreApp) GetDbNamesWithoutRestore(instanceId uint64, dbNames []s
|
||||
return app.restoreRepo.GetDbNamesWithoutRestore(instanceId, dbNames)
|
||||
}
|
||||
|
||||
// 分页获取数据库备份历史
|
||||
func (app *DbRestoreApp) GetHistoryPageList(condition *entity.DbRestoreHistoryQuery, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error) {
|
||||
return app.restoreHistoryRepo.GetDbRestoreHistories(condition, pageParam, toEntity, orderBy...)
|
||||
}
|
||||
|
||||
func (app *DbRestoreApp) runTask(ctx context.Context, task *entity.DbRestore) error {
|
||||
conn, err := app.dbApp.GetDbConnByInstanceId(task.DbInstanceId)
|
||||
if err != nil {
|
||||
@@ -173,19 +178,3 @@ func withRunRestoreTask(app *DbRestoreApp) dbSchedulerOption[*entity.DbRestore]
|
||||
scheduler.RunTask = app.runTask
|
||||
}
|
||||
}
|
||||
|
||||
func newDbRestoreHistoryApp(repositories *repository.Repositories) (*DbRestoreHistoryApp, error) {
|
||||
app := &DbRestoreHistoryApp{
|
||||
repo: repositories.RestoreHistory,
|
||||
}
|
||||
return app, nil
|
||||
}
|
||||
|
||||
type DbRestoreHistoryApp struct {
|
||||
repo repository.DbRestoreHistory
|
||||
}
|
||||
|
||||
// GetPageList 分页获取数据库备份历史
|
||||
func (app *DbRestoreHistoryApp) GetPageList(condition *entity.DbRestoreHistoryQuery, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error) {
|
||||
return app.repo.GetDbRestoreHistories(condition, pageParam, toEntity, orderBy...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user