Permalink
Browse files

Fix pagination for queries with joins by upgrading gorm

Gorm now includes a way of counting the number of total records
when grouping in a query. Gorm detects the grouping and counts
the records as a subquery.
  • Loading branch information...
mraerino committed Oct 18, 2018
1 parent a0658ef commit 5dd42e1ddc5c10eb004ad1d1a4464e8503b7e158
Showing with 4 additions and 6 deletions.
  1. +0 −3 api/utils_test.go
  2. +3 −3 glide.lock
  3. +1 −0 glide.yaml
@@ -252,9 +252,6 @@ func loadTestData(t *testing.T, db *gorm.DB) *TestData {
require.NoError(t, db.Create(testData.firstLineItem).Error)
require.NoError(t, db.Create(testData.firstOrder).Error)
require.NoError(t, db.Create(testData.firstTransaction).Error)
for _, d := range testData.firstOrder.Downloads {
require.NoError(t, db.Create(d).Error)
}
require.NoError(t, db.Create(testData.secondLineItem1).Error)
require.NoError(t, db.Create(testData.secondLineItem2).Error)

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -6,6 +6,7 @@ import:
- package: github.com/go-sql-driver/mysql
version: v1.3
- package: github.com/jinzhu/gorm
version: v1.9.1
- package: github.com/lib/pq
- package: github.com/mattn/go-sqlite3
version: v1.1.0

0 comments on commit 5dd42e1

Please sign in to comment.