refactor: base.repo与app重构优化

This commit is contained in:
meilin.huang
2024-05-05 14:53:30 +08:00
parent 4ed892a656
commit 78957a8ebd
75 changed files with 544 additions and 512 deletions

View File

@@ -42,8 +42,8 @@ func (repo *dbBinlogHistoryRepoImpl) GetHistories(instanceId uint64, start, targ
Ge("sequence", start.Sequence).
Le("sequence", target.Sequence).
OrderByAsc("sequence")
var histories []*entity.DbBinlogHistory
if err := repo.SelectByCond(qc, &histories); err != nil {
histories, err := repo.SelectByCond(qc)
if err != nil {
return nil, err
}
if len(histories) == 0 {
@@ -121,7 +121,7 @@ func (repo *dbBinlogHistoryRepoImpl) InsertWithBinlogFiles(ctx context.Context,
}
func (repo *dbBinlogHistoryRepoImpl) GetHistoriesBeforeSequence(ctx context.Context, instanceId uint64, binlogSeq int64, histories *[]*entity.DbBinlogHistory) error {
return global.Db.Model(repo.GetModel()).
return global.Db.Model(repo.NewModel()).
Where("db_instance_id = ?", instanceId).
Where("sequence < ?", binlogSeq).
Scopes(gormx.UndeleteScope).