@@ -20,6 +20,7 @@ import {
20
20
UpdateOneOptions
21
21
} from '@ptc-org/nestjs-query-core'
22
22
import { DeleteResult , FindOptionsWhere , Repository } from 'typeorm'
23
+ import { DriverUtils } from 'typeorm/driver/DriverUtils'
23
24
import { QueryDeepPartialEntity } from 'typeorm/query-builder/QueryPartialEntity'
24
25
import { UpdateResult } from 'typeorm/query-builder/result/UpdateResult'
25
26
@@ -55,6 +56,8 @@ export class TypeOrmQueryService<Entity>
55
56
56
57
readonly useSoftDelete : boolean
57
58
59
+ private readonly isMySQL : boolean
60
+
58
61
constructor (
59
62
readonly repo : Repository < Entity > ,
60
63
opts ?: TypeOrmQueryServiceOpts < Entity >
@@ -63,6 +66,8 @@ export class TypeOrmQueryService<Entity>
63
66
64
67
this . filterQueryBuilder = opts ?. filterQueryBuilder ?? new FilterQueryBuilder < Entity > ( this . repo )
65
68
this . useSoftDelete = opts ?. useSoftDelete ?? false
69
+
70
+ this . isMySQL = DriverUtils . isMySQLFamily ( repo . manager . connection . driver )
66
71
}
67
72
68
73
// eslint-disable-next-line @typescript-eslint/naming-convention
@@ -84,6 +89,9 @@ export class TypeOrmQueryService<Entity>
84
89
* @param query - The Query used to filter, page, and sort rows.
85
90
*/
86
91
public async query ( query : Query < Entity > , opts ?: QueryOptions < Entity > ) : Promise < Entity [ ] > {
92
+ if ( this . isMySQL && query . paging . offset && ! query . paging ?. limit ) {
93
+ query = { ...query , paging : { ...query . paging , limit : Number . MAX_SAFE_INTEGER } }
94
+ }
87
95
const qb = this . filterQueryBuilder . select ( query )
88
96
89
97
if ( opts ?. withDeleted ) {
0 commit comments