@mikro-orm/knex 6.0.6-dev.2 → 6.0.6-dev.21
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/index.mjs +1 -0
- package/package.json +2 -2
- package/query/QueryBuilder.d.ts +1 -1
- package/query/QueryBuilder.js +6 -3
package/index.mjs
CHANGED
|
@@ -43,6 +43,7 @@ export const CreateRequestContext = mod.CreateRequestContext;
|
|
|
43
43
|
export const CriteriaNode = mod.CriteriaNode;
|
|
44
44
|
export const CriteriaNodeFactory = mod.CriteriaNodeFactory;
|
|
45
45
|
export const Cursor = mod.Cursor;
|
|
46
|
+
export const CursorError = mod.CursorError;
|
|
46
47
|
export const DatabaseDriver = mod.DatabaseDriver;
|
|
47
48
|
export const DatabaseObjectExistsException = mod.DatabaseObjectExistsException;
|
|
48
49
|
export const DatabaseObjectNotFoundException = mod.DatabaseObjectNotFoundException;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/knex",
|
|
3
|
-
"version": "6.0.6-dev.
|
|
3
|
+
"version": "6.0.6-dev.21",
|
|
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",
|
|
@@ -66,6 +66,6 @@
|
|
|
66
66
|
"@mikro-orm/core": "^6.0.5"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@mikro-orm/core": "6.0.6-dev.
|
|
69
|
+
"@mikro-orm/core": "6.0.6-dev.21"
|
|
70
70
|
}
|
|
71
71
|
}
|
package/query/QueryBuilder.d.ts
CHANGED
|
@@ -208,7 +208,7 @@ export declare class QueryBuilder<T extends object = AnyEntity> {
|
|
|
208
208
|
/**
|
|
209
209
|
* Executes the query, returning array of results
|
|
210
210
|
*/
|
|
211
|
-
getResultList(): Promise<T[]>;
|
|
211
|
+
getResultList(limit?: number): Promise<T[]>;
|
|
212
212
|
/**
|
|
213
213
|
* Executes the query, returning the first result or null
|
|
214
214
|
*/
|
package/query/QueryBuilder.js
CHANGED
|
@@ -641,7 +641,7 @@ class QueryBuilder {
|
|
|
641
641
|
/**
|
|
642
642
|
* Executes the query, returning array of results
|
|
643
643
|
*/
|
|
644
|
-
async getResultList() {
|
|
644
|
+
async getResultList(limit) {
|
|
645
645
|
await this.em.tryFlush(this.mainAlias.entityName, { flushMode: this.flushMode });
|
|
646
646
|
const res = await this.execute('all', true);
|
|
647
647
|
const entities = [];
|
|
@@ -664,6 +664,9 @@ class QueryBuilder {
|
|
|
664
664
|
const entity = this.em.map(this.mainAlias.entityName, r, { schema: this._schema });
|
|
665
665
|
propagatePopulateHint(entity, this._populate);
|
|
666
666
|
entities.push(entity);
|
|
667
|
+
if (limit != null && --limit === 0) {
|
|
668
|
+
break;
|
|
669
|
+
}
|
|
667
670
|
}
|
|
668
671
|
return entities;
|
|
669
672
|
}
|
|
@@ -671,8 +674,8 @@ class QueryBuilder {
|
|
|
671
674
|
* Executes the query, returning the first result or null
|
|
672
675
|
*/
|
|
673
676
|
async getSingleResult() {
|
|
674
|
-
const res = await this.getResultList();
|
|
675
|
-
return res
|
|
677
|
+
const [res] = await this.getResultList(1);
|
|
678
|
+
return res || null;
|
|
676
679
|
}
|
|
677
680
|
/**
|
|
678
681
|
* Executes count query (without offset and limit), returning total count of results
|