(
entityName: EntityName<T>,
where: ObjectQuery<T>,
options: FindOptions<T, P, F, E> = {},
)
| 251 | } |
| 252 | |
| 253 | async find<T extends object, P extends string = never, F extends string = never, E extends string = never>( |
| 254 | entityName: EntityName<T>, |
| 255 | where: ObjectQuery<T>, |
| 256 | options: FindOptions<T, P, F, E> = {}, |
| 257 | ): Promise<EntityData<T>[]> { |
| 258 | options = { populate: [], orderBy: [], ...options }; |
| 259 | const meta = this.metadata.get(entityName); |
| 260 | |
| 261 | if (meta.virtual) { |
| 262 | return this.findVirtual<T>(entityName, where, options); |
| 263 | } |
| 264 | |
| 265 | if (options.unionWhere?.length) { |
| 266 | where = await this.applyUnionWhere(meta, where, options); |
| 267 | } |
| 268 | |
| 269 | const qb = await this.createQueryBuilderFromOptions(meta, where, options); |
| 270 | const result = await this.rethrow(qb.execute('all')); |
| 271 | |
| 272 | if (options.last && !options.first) { |
| 273 | result.reverse(); |
| 274 | } |
| 275 | |
| 276 | return result; |
| 277 | } |
| 278 | |
| 279 | async findOne<T extends object, P extends string = never, F extends string = never, E extends string = never>( |
| 280 | entityName: EntityName<T>, |
nothing calls this directly
no test coverage detected