(
entityName: EntityName<T>,
where: FilterQuery<T> | string | any,
options: DeleteOptions<T> = {},
)
| 1650 | } |
| 1651 | |
| 1652 | async nativeDelete<T extends object>( |
| 1653 | entityName: EntityName<T>, |
| 1654 | where: FilterQuery<T> | string | any, |
| 1655 | options: DeleteOptions<T> = {}, |
| 1656 | ): Promise<QueryResult<T>> { |
| 1657 | const meta = this.metadata.get(entityName); |
| 1658 | const pks = this.getPrimaryKeyFields(meta); |
| 1659 | |
| 1660 | if (Utils.isPrimaryKey(where) && pks.length === 1) { |
| 1661 | where = { [pks[0]]: where }; |
| 1662 | } |
| 1663 | |
| 1664 | if (options.unionWhere?.length) { |
| 1665 | where = await this.applyUnionWhere(meta, where as ObjectQuery<T>, options, true); |
| 1666 | } |
| 1667 | |
| 1668 | const qb = this.createQueryBuilder(entityName, options.ctx, 'write', false, options.loggerContext) |
| 1669 | .delete(where) |
| 1670 | .withSchema(this.getSchemaName(meta, options)); |
| 1671 | qb.setAbortOptions(pickAbortOptions(options)); |
| 1672 | |
| 1673 | return this.rethrow(qb.execute('run', false)); |
| 1674 | } |
| 1675 | |
| 1676 | /** |
| 1677 | * Fast comparison for collection snapshots that are represented by PK arrays. |
nothing calls this directly
no test coverage detected