Skip to content

Commit

Permalink
Remove offset and limit from count queries. Fixes #2443
Browse files Browse the repository at this point in the history
  • Loading branch information
deluan committed Jan 21, 2024
1 parent 2fb913f commit 2b33ef7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion persistence/radio_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 35,7 @@ func (r *radioRepository) isPermitted() bool {
}

func (r *radioRepository) CountAll(options ...model.QueryOptions) (int64, error) {
sql := r.newSelect(options...)
sql := r.newSelect()
return r.count(sql, options...)
}

Expand Down
1 change: 1 addition & 0 deletions persistence/sql_base_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 231,7 @@ func (r sqlRepository) exists(existsQuery SelectBuilder) (bool, error) {
func (r sqlRepository) count(countQuery SelectBuilder, options ...model.QueryOptions) (int64, error) {
countQuery = countQuery.
RemoveColumns().Columns("count(distinct " r.tableName ".id) as count").
RemoveOffset().RemoveLimit().
From(r.tableName)
countQuery = r.applyFilters(countQuery, options...)
var res struct{ Count int64 }
Expand Down

0 comments on commit 2b33ef7

Please sign in to comment.