(
entityName: EntityName<T>,
where: FilterQuery<T>,
options: StreamOptions<T, any, any, any> & { rawResults?: boolean },
)
| 50 | } |
| 51 | |
| 52 | async *stream<T extends object>( |
| 53 | entityName: EntityName<T>, |
| 54 | where: FilterQuery<T>, |
| 55 | options: StreamOptions<T, any, any, any> & { rawResults?: boolean }, |
| 56 | ): AsyncIterableIterator<T> { |
| 57 | if (this.metadata.find(entityName)?.virtual) { |
| 58 | yield* this.streamVirtual(entityName, where, options) as any; |
| 59 | return; |
| 60 | } |
| 61 | |
| 62 | const fields = this.buildFields( |
| 63 | entityName, |
| 64 | (options.populate as unknown as PopulateOptions<T>[]) || [], |
| 65 | options.fields, |
| 66 | options.exclude as any, |
| 67 | ); |
| 68 | where = this.renameFields(entityName, where as T, true); |
| 69 | const orderBy = Utils.asArray(options.orderBy).map(orderBy => this.renameFields(entityName, orderBy as T, true)); |
| 70 | const res = this.getConnection('read').stream(entityName, where, { |
| 71 | orderBy, |
| 72 | limit: options.limit, |
| 73 | offset: options.offset, |
| 74 | fields, |
| 75 | ctx: options.ctx, |
| 76 | chunkSize: options.chunkSize ?? 100, |
| 77 | ...this.buildQueryOptions(options), |
| 78 | }); |
| 79 | |
| 80 | for await (const item of res) { |
| 81 | if (options.rawResults) { |
| 82 | yield item as any; |
| 83 | } else { |
| 84 | yield this.mapResult(item, this.metadata.find(entityName)) as T; |
| 85 | } |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | async find<T extends object, P extends string = never, F extends string = never, E extends string = never>( |
| 90 | entityName: EntityName<T>, |
nothing calls this directly
no test coverage detected