Skip to content

Commit

Permalink
Merge pull request #17 from axieinfinity/revert-16-feature/removed-rows
Browse files Browse the repository at this point in the history
Revert "Now Delete methods return the number of affected rows"
  • Loading branch information
ssscrom authored Oct 17, 2022
2 parents a73dac4 + c254641 commit 2d9310c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
5 changes: 2 additions & 3 deletions stores/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ func (e *eventStore) Save(event *models.Event) error {
return e.Clauses(clause.OnConflict{DoNothing: true}).Create(event).Error
}

func (e *eventStore) DeleteEvents(createdAt uint64) (int64, error) {
db := e.Where("created_at <= ?", createdAt).Delete(&models.Event{})
return db.RowsAffected, db.Error
func (e *eventStore) DeleteEvents(createdAt uint64) error {
return e.Where("created_at <= ?", createdAt).Delete(&models.Event{}).Error
}

func (e *eventStore) Count() int64 {
Expand Down
5 changes: 2 additions & 3 deletions stores/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,8 @@ func (j *jobStore) SearchJobs(req *SearchJobs) ([]*models.Job, error) {
return jobs, nil
}

func (j *jobStore) DeleteJobs(status []string, createdAt uint64) (int64, error) {
db := j.Where("status in ? AND created_at <= ?", status, createdAt).Delete(&models.Job{})
return db.RowsAffected, db.Error
func (j *jobStore) DeleteJobs(status []string, createdAt uint64) error {
return j.Where("status in ? AND created_at <= ?", status, createdAt).Delete(&models.Job{}).Error
}

func (j *jobStore) Count() int64 {
Expand Down
4 changes: 2 additions & 2 deletions stores/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type JobStore interface {
Update(job *models.Job) error
GetPendingJobs() ([]*models.Job, error)
SearchJobs(req *SearchJobs) ([]*models.Job, error)
DeleteJobs([]string, uint64) (int64, error)
DeleteJobs([]string, uint64) error
Count() int64
}

Expand All @@ -46,7 +46,7 @@ type ProcessedBlockStore interface {

type EventStore interface {
Save(event *models.Event) error
DeleteEvents(uint64) (int64, error)
DeleteEvents(uint64) error
Count() int64
}

Expand Down

0 comments on commit 2d9310c

Please sign in to comment.