Skip to content

Commit

Permalink
fix: invalid is_last_page
Browse files Browse the repository at this point in the history
  • Loading branch information
litsynp committed Feb 3, 2024
1 parent c3de2ec commit 8f2154c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/postgres/breed_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (s *BreedPostgresStore) FindBreeds(page int, size int, petType *string) (*p
OFFSET $3
`

rows, err := tx.Query(query, petType, size, (page-1)*size)
rows, err := tx.Query(query, petType, size+1, (page-1)*size)
if err != nil {
return nil, pnd.FromPostgresError(err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/postgres/sos_post_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func (s *SosPostPostgresStore) FindSosPosts(page int, size int, sortBy string) (
query += " ORDER BY created_at DESC"
}

query += fmt.Sprintf(" LIMIT %d", size)
query += fmt.Sprintf(" LIMIT %d", size+1)
query += fmt.Sprintf(" OFFSET %d", (page-1)*size)

rows, err := tx.Query(query)
Expand Down

0 comments on commit 8f2154c

Please sign in to comment.