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

Method processUnionWhere

packages/core/src/EntityManager.ts:497–522  ·  view source on GitHub ↗
(
    entityName: EntityName<Entity>,
    options:
      | FindOptions<Entity, Hint, any, any>
      | CountOptions<Entity, Hint>
      | UpdateOptions<Entity>
      | DeleteOptions<Entity>,
    type: 'read' | 'update' | 'delete',
  )

Source from the content-addressed store, hash-verified

495 }
496
497 protected async processUnionWhere<Entity extends object, Hint extends string = never>(
498 entityName: EntityName<Entity>,
499 options:
500 | FindOptions<Entity, Hint, any, any>
501 | CountOptions<Entity, Hint>
502 | UpdateOptions<Entity>
503 | DeleteOptions<Entity>,
504 type: 'read' | 'update' | 'delete',
505 ): Promise<void> {
506 if (options.unionWhere?.length) {
507 if (!this.driver.getPlatform().supportsUnionWhere()) {
508 throw new Error(`unionWhere is only supported on SQL drivers`);
509 }
510
511 options.unionWhere = (await Promise.all(
512 options.unionWhere.map(branch =>
513 this.processWhere(
514 entityName,
515 branch as FilterQuery<NoInfer<Entity>>,
516 options as FindOptions<Entity, Hint>,
517 type,
518 ),
519 ),
520 )) as ObjectQuery<Entity>[];
521 }
522 }
523
524 // this method only handles the problem for mongo driver, SQL drivers have their implementation inside QueryBuilder
525 protected applyDiscriminatorCondition<Entity extends object>(

Callers 5

findMethod · 0.80
findOneMethod · 0.80
nativeUpdateMethod · 0.80
nativeDeleteMethod · 0.80
countMethod · 0.80

Calls 3

processWhereMethod · 0.95
getPlatformMethod · 0.65
mapMethod · 0.45

Tested by

no test coverage detected