Skip to content

Commit

Permalink
fix: use holes instead of holeIDs when dump
Browse files Browse the repository at this point in the history
  • Loading branch information
ppolariss committed Jun 29, 2024
1 parent 5cef7c0 commit 7250852
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ import (
)

func Dump() {
var holeIDs []int
var holes Holes
var floors Floors
result := DB.Model(&Hole{}).
Select("id").
Where("hidden = false").
FindInBatches(&holeIDs, 1000, func(tx *gorm.DB, batch int) error {
if len(holeIDs) == 0 {
result := DB.Where("hidden = false").
FindInBatches(&holes, 1000, func(tx *gorm.DB, batch int) error {
if len(holes) == 0 {
return nil
}

Expand All @@ -34,7 +32,7 @@ func Dump() {
return err
}

log.Printf("insert holes [%d, %d]\n", holeIDs[0], holeIDs[len(holeIDs)-1])
log.Printf("insert holes [%d, %d]\n", holes[0].ID, holes[len(holes)-1].ID)
return nil
})

Expand Down

0 comments on commit 7250852

Please sign in to comment.