Skip to content

Commit

Permalink
refactor: query builder
Browse files Browse the repository at this point in the history
  • Loading branch information
kiddyuchina committed Apr 13, 2024
1 parent 586c0f9 commit e279b65
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/query-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ class QueryBuilder {
let countResults;

do {
const builder = this.connector.clone();
const builder = this.clone();
const results = await builder.forPage(page, count).get();

countResults = results.count();
countResults = results.length;

if (countResults == 0) {
break;
Expand All @@ -123,7 +123,7 @@ class QueryBuilder {
}

async paginate(page = 1, perPage = 15) {
const query = this.connector.clone();
const query = this.clone();

const total = await query.clearOrder().count('*');

Expand Down Expand Up @@ -179,15 +179,15 @@ class QueryBuilder {
}

async delete() {
return this.connector.delete();
return await this.connector.delete();
}

async insert(...args) {
return this.connector.insert(...args);
return await this.connector.insert(...args);
}

async update(...args) {
return this.connector.update(...args);
return await this.connector.update(...args);
}

destroy(...args) {
Expand Down

0 comments on commit e279b65

Please sign in to comment.