knex-paginate
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -43,2 +43,4 @@ const Knex = require('knex'); | ||
if (shouldFetchTotals) { | ||
const groupStmt = this._statements.find(stmt => stmt.grouping === 'group'); | ||
const countQuery = await this.clone() | ||
@@ -50,4 +52,9 @@ .clearSelect() | ||
qb._clearGrouping('group'); | ||
if (groupStmt) { | ||
qb.count(`${groupStmt.value[0]} as total`, { distinct: true }); | ||
} else { | ||
qb.count('* as total'); | ||
} | ||
}) | ||
.count('* as total') | ||
.offset(0) | ||
@@ -54,0 +61,0 @@ .first() |
{ | ||
"name": "knex-paginate", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Extension of Knex's query builder with `paginate` method that will help with your pagination tasks.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6695
92