@mikro-orm/core
Advanced tools
Comparing version
@@ -152,3 +152,4 @@ import type { ConnectionType, EntityData, EntityMetadata, EntityProperty, FilterQuery, Primary, Dictionary, QBFilterQuery, IPrimaryKey, PopulateOptions, EntityDictionary, AutoPath, ObjectQuery, FilterObject, Populate } from '../typings'; | ||
} | ||
export interface FindByCursorOptions<T extends object, P extends string = never, F extends string = '*', E extends string = never> extends Omit<FindOptions<T, P, F, E>, 'limit' | 'offset'> { | ||
export interface FindByCursorOptions<T extends object, P extends string = never, F extends string = '*', E extends string = never, I extends boolean = true> extends Omit<FindOptions<T, P, F, E>, 'limit' | 'offset'> { | ||
includeCount?: I; | ||
} | ||
@@ -155,0 +156,0 @@ export interface FindOneOptions<T extends object, P extends string = never, F extends string = '*', E extends string = never> extends Omit<FindOptions<T, P, F, E>, 'limit' | 'lockMode'> { |
@@ -168,2 +168,6 @@ import { inspect } from 'node:util'; | ||
* | ||
* The options also support an `includeCount` (true by default) option. If set to false, the `totalCount` is not | ||
* returned as part of the cursor. This is useful for performance reason, when you don't care about the total number | ||
* of pages. | ||
* | ||
* The `Cursor` object provides the following interface: | ||
@@ -178,3 +182,3 @@ * | ||
* ], | ||
* totalCount: 50, | ||
* totalCount: 50, // not included if `includeCount: false` | ||
* startCursor: 'WzRd', | ||
@@ -187,3 +191,3 @@ * endCursor: 'WzZd', | ||
*/ | ||
findByCursor<Entity extends object, Hint extends string = never, Fields extends string = '*', Excludes extends string = never>(entityName: EntityName<Entity>, where: FilterQuery<NoInfer<Entity>>, options: FindByCursorOptions<Entity, Hint, Fields, Excludes>): Promise<Cursor<Entity, Hint, Fields, Excludes>>; | ||
findByCursor<Entity extends object, Hint extends string = never, Fields extends string = '*', Excludes extends string = never, IncludeCount extends boolean = true>(entityName: EntityName<Entity>, where: FilterQuery<NoInfer<Entity>>, options: FindByCursorOptions<Entity, Hint, Fields, Excludes, IncludeCount>): Promise<Cursor<Entity, Hint, Fields, Excludes, IncludeCount>>; | ||
/** | ||
@@ -190,0 +194,0 @@ * Refreshes the persistent state of an entity from the database, overriding any local changes that have not yet been |
{ | ||
"name": "@mikro-orm/core", | ||
"version": "6.4.12-dev.1", | ||
"version": "6.4.12-dev.2", | ||
"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.", | ||
@@ -67,5 +67,5 @@ "main": "index.js", | ||
"globby": "11.1.0", | ||
"mikro-orm": "6.4.12-dev.1", | ||
"mikro-orm": "6.4.12-dev.2", | ||
"reflect-metadata": "0.2.2" | ||
} | ||
} |
@@ -52,9 +52,9 @@ import { inspect } from 'node:util'; | ||
*/ | ||
export declare class Cursor<Entity extends object, Hint extends string = never, Fields extends string = '*', Excludes extends string = never> { | ||
export declare class Cursor<Entity extends object, Hint extends string = never, Fields extends string = '*', Excludes extends string = never, IncludeCount extends boolean = true> { | ||
readonly items: Loaded<Entity, Hint, Fields, Excludes>[]; | ||
readonly totalCount: number; | ||
readonly totalCount: IncludeCount extends true ? number : undefined; | ||
readonly hasPrevPage: boolean; | ||
readonly hasNextPage: boolean; | ||
private readonly definition; | ||
constructor(items: Loaded<Entity, Hint, Fields, Excludes>[], totalCount: number, options: FindByCursorOptions<Entity, Hint, Fields, Excludes>, meta: EntityMetadata<Entity>); | ||
constructor(items: Loaded<Entity, Hint, Fields, Excludes>[], totalCount: IncludeCount extends true ? number : undefined, options: FindByCursorOptions<Entity, Hint, Fields, Excludes, IncludeCount>, meta: EntityMetadata<Entity>); | ||
get startCursor(): string | null; | ||
@@ -61,0 +61,0 @@ get endCursor(): string | null; |
Sorry, the diff of this file is too big to display
1103327
0.09%24399
0.05%+ Added
- Removed
Updated