@mikro-orm/knex 6.0.0-dev.17 → 6.0.0-dev.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SqlEntityManager.js +1 -1
- package/package.json +3 -3
- package/query/QueryBuilder.d.ts +4 -0
- package/query/QueryBuilder.js +9 -0
package/SqlEntityManager.js
CHANGED
|
@@ -35,7 +35,7 @@ class SqlEntityManager extends core_1.EntityManager {
|
|
|
35
35
|
return this.getConnection(type).getKnex();
|
|
36
36
|
}
|
|
37
37
|
async execute(queryOrKnex, params = [], method = 'all') {
|
|
38
|
-
return this.getDriver().execute(queryOrKnex, params, method, this.getTransactionContext());
|
|
38
|
+
return this.getDriver().execute(queryOrKnex, params, method, this.getContext(false).getTransactionContext());
|
|
39
39
|
}
|
|
40
40
|
getRepository(entityName) {
|
|
41
41
|
return super.getRepository(entityName);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/knex",
|
|
3
|
-
"version": "6.0.0-dev.
|
|
3
|
+
"version": "6.0.0-dev.19",
|
|
4
4
|
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
"sqlstring": "2.3.3"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@mikro-orm/core": "^5.6.
|
|
66
|
+
"@mikro-orm/core": "^5.6.3"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@mikro-orm/core": "~6.0.0-dev.
|
|
69
|
+
"@mikro-orm/core": "~6.0.0-dev.19"
|
|
70
70
|
}
|
|
71
71
|
}
|
package/query/QueryBuilder.d.ts
CHANGED
|
@@ -181,6 +181,10 @@ export declare class QueryBuilder<T extends object = AnyEntity> {
|
|
|
181
181
|
* Executes count query (without offset and limit), returning total count of results
|
|
182
182
|
*/
|
|
183
183
|
getCount(field?: string | string[], distinct?: boolean): Promise<number>;
|
|
184
|
+
/**
|
|
185
|
+
* Executes the query, returning both array of results and total count query (without offset and limit).
|
|
186
|
+
*/
|
|
187
|
+
getResultAndCount(): Promise<[T[], number]>;
|
|
184
188
|
/**
|
|
185
189
|
* Provides promise-like interface so we can await the QB instance.
|
|
186
190
|
*/
|
package/query/QueryBuilder.js
CHANGED
|
@@ -489,6 +489,15 @@ class QueryBuilder {
|
|
|
489
489
|
}
|
|
490
490
|
return res ? +res.count : 0;
|
|
491
491
|
}
|
|
492
|
+
/**
|
|
493
|
+
* Executes the query, returning both array of results and total count query (without offset and limit).
|
|
494
|
+
*/
|
|
495
|
+
async getResultAndCount() {
|
|
496
|
+
return Promise.all([
|
|
497
|
+
this.getResultList(),
|
|
498
|
+
this.getCount(),
|
|
499
|
+
]);
|
|
500
|
+
}
|
|
492
501
|
/**
|
|
493
502
|
* Provides promise-like interface so we can await the QB instance.
|
|
494
503
|
*/
|