* Fires native delete query. Calling this has no side effects on the context (identity map).
(
entityName: EntityName<Entity>,
where: FilterQuery<NoInfer<Entity>>,
options: DeleteOptions<Entity> = {},
)
| 1990 | * Fires native delete query. Calling this has no side effects on the context (identity map). |
| 1991 | */ |
| 1992 | async nativeDelete<Entity extends object>( |
| 1993 | entityName: EntityName<Entity>, |
| 1994 | where: FilterQuery<NoInfer<Entity>>, |
| 1995 | options: DeleteOptions<Entity> = {}, |
| 1996 | ): Promise<number> { |
| 1997 | const em = this.getContext(false); |
| 1998 | em.prepareOptions(options); |
| 1999 | |
| 2000 | await em.processUnionWhere(entityName, options, 'delete'); |
| 2001 | |
| 2002 | where = (await em.processWhere( |
| 2003 | entityName, |
| 2004 | where as FilterQuery<Entity>, |
| 2005 | options as FindOptions<Entity>, |
| 2006 | 'delete', |
| 2007 | )) as typeof where; |
| 2008 | validateParams(where, 'delete condition'); |
| 2009 | const res = await em.driver.nativeDelete(entityName, where, { |
| 2010 | ctx: em.#transactionContext, |
| 2011 | em, |
| 2012 | ...options, |
| 2013 | } as NativeDeleteOptions<Entity>); |
| 2014 | |
| 2015 | return res.affectedRows; |
| 2016 | } |
| 2017 | |
| 2018 | /** |
| 2019 | * Maps raw database result to an entity and merges it to this EntityManager. |
nothing calls this directly
no test coverage detected