Skip to content

Commit c7f7016

Browse files
committed
feat: add SQLKITException handling for missing executor in SelectQueryBuilder
1 parent d5f4e14 commit c7f7016

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/query-builder/select.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { SQLKITException } from "../exceptions";
12
import {
23
Join,
34
OrderBy,
@@ -98,6 +99,10 @@ export class SelectQueryBuilder<T> extends BaseQueryBuilder<T> {
9899
}
99100

100101
async paginate(options: PaginationOptions<T>): Promise<PaginatedResult<T>> {
102+
if(!this?.executor){
103+
throw new SQLKITException("Executor is not set for the query builder.");
104+
}
105+
101106
const limit = options.limit || 10;
102107
const page = options.page || 1;
103108
const offset = (page - 1) * limit;
@@ -132,7 +137,7 @@ export class SelectQueryBuilder<T> extends BaseQueryBuilder<T> {
132137
}
133138
`;
134139

135-
const countResult = await this.executor.executeSQL(
140+
const countResult: any = await this.executor.executeSQL(
136141
countSql,
137142
buildWhereClause(options.where, this.tableName).values
138143
);

0 commit comments

Comments
 (0)