refactor: 精简base.repo与base.app等

This commit is contained in:
meilin.huang
2024-04-28 23:45:57 +08:00
parent 653953ee76
commit f2c7ef78c0
91 changed files with 758 additions and 957 deletions

View File

@@ -5,7 +5,6 @@ import (
"encoding/binary"
"errors"
"fmt"
"gorm.io/gorm"
"math"
"mayfly-go/internal/db/domain/entity"
"mayfly-go/internal/db/domain/repository"
@@ -15,6 +14,8 @@ import (
"sync"
"time"
"gorm.io/gorm"
"github.com/google/uuid"
)
@@ -74,7 +75,7 @@ func (app *DbBackupApp) prune(ctx context.Context) error {
historyCond := map[string]any{
"db_backup_id": job.Id,
}
if err := app.backupHistoryRepo.ListByCondOrder(historyCond, &histories, "id"); err != nil {
if err := app.backupHistoryRepo.SelectByCond(historyCond, &histories); err != nil {
return err
}
expiringTime := time.Now().Add(-math.MaxInt64)
@@ -140,7 +141,7 @@ func (app *DbBackupApp) Delete(ctx context.Context, jobId uint64) error {
history := &entity.DbBackupHistory{
DbBackupId: jobId,
}
err := app.backupHistoryRepo.GetBy(history, "name")
err := app.backupHistoryRepo.GetByCond(history)
switch {
default:
return err