MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / mapResults

Method mapResults

packages/sql/src/query/QueryBuilder.ts:2632–2646  ·  view source on GitHub ↗
(res: EntityData<Entity>[], limit?: number)

Source from the content-addressed store, hash-verified

2630 }
2631
2632 private mapResults(res: EntityData<Entity>[], limit?: number): Loaded<Entity, Hint, Fields>[] {
2633 const entities: Loaded<Entity, Hint, Fields>[] = [];
2634
2635 for (const row of res) {
2636 const entity = this.mapResult(row);
2637 this.propagatePopulateHint(entity as Entity, this.#state.populate);
2638 entities.push(entity);
2639
2640 if (limit != null && --limit === 0) {
2641 break;
2642 }
2643 }
2644
2645 return Utils.unique(entities);
2646 }
2647
2648 /**
2649 * Executes the query, returning the first result or null

Callers 1

getResultListMethod · 0.95

Calls 4

mapResultMethod · 0.95
propagatePopulateHintMethod · 0.95
pushMethod · 0.80
uniqueMethod · 0.65

Tested by

no test coverage detected