Fix Count methods
This commit is contained in:
@@ -179,7 +179,7 @@ func (r sqlRepository) exists(existsQuery SelectBuilder) (bool, error) {
|
||||
}
|
||||
|
||||
func (r sqlRepository) count(countQuery SelectBuilder, options ...model.QueryOptions) (int64, error) {
|
||||
countQuery = countQuery.Columns("count(*) as count").From(r.tableName)
|
||||
countQuery = countQuery.Columns("count(distinct " + r.tableName + ".id) as count").From(r.tableName)
|
||||
countQuery = r.applyFilters(countQuery, options...)
|
||||
var res struct{ Count int64 }
|
||||
err := r.queryOne(countQuery, &res)
|
||||
|
||||
Reference in New Issue
Block a user