GelDeleteBase Class — drizzle-orm Architecture
Architecture documentation for the GelDeleteBase class in delete.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 4f0c8e1c_013f_d2db_c519_d31b8f838f08["GelDeleteBase"] ef93bf01_da17_ca76_efbc_b9108d7fe88d["delete.ts"] 4f0c8e1c_013f_d2db_c519_d31b8f838f08 -->|defined in| ef93bf01_da17_ca76_efbc_b9108d7fe88d 7a23b08e_b95f_2f41_12f8_442a357c72fb["constructor()"] 4f0c8e1c_013f_d2db_c519_d31b8f838f08 -->|method| 7a23b08e_b95f_2f41_12f8_442a357c72fb 0780ca65_5668_966b_9704_b7dd1afd1045["where()"] 4f0c8e1c_013f_d2db_c519_d31b8f838f08 -->|method| 0780ca65_5668_966b_9704_b7dd1afd1045 796a564d_bb6d_3060_5492_ae29b9a9e315["returning()"] 4f0c8e1c_013f_d2db_c519_d31b8f838f08 -->|method| 796a564d_bb6d_3060_5492_ae29b9a9e315 95416b05_8d5f_436c_fc40_cf03a14ed63f["getSQL()"] 4f0c8e1c_013f_d2db_c519_d31b8f838f08 -->|method| 95416b05_8d5f_436c_fc40_cf03a14ed63f 548f38a1_7252_7cf0_8bd3_39a47a730720["toSQL()"] 4f0c8e1c_013f_d2db_c519_d31b8f838f08 -->|method| 548f38a1_7252_7cf0_8bd3_39a47a730720 076cbe96_90a4_b38c_95bc_04fe429ae0f4["_prepare()"] 4f0c8e1c_013f_d2db_c519_d31b8f838f08 -->|method| 076cbe96_90a4_b38c_95bc_04fe429ae0f4 a22854b2_ff15_480b_652f_b3ffffc22767["prepare()"] 4f0c8e1c_013f_d2db_c519_d31b8f838f08 -->|method| a22854b2_ff15_480b_652f_b3ffffc22767 7472a211_120c_7bbd_06e6_74afca99f962["$dynamic()"] 4f0c8e1c_013f_d2db_c519_d31b8f838f08 -->|method| 7472a211_120c_7bbd_06e6_74afca99f962
Relationship Graph
Source Code
drizzle-orm/src/gel-core/query-builders/delete.ts lines 120–248
export class GelDeleteBase<
TTable extends GelTable,
TQueryResult extends GelQueryResultHKT,
TReturning extends Record<string, unknown> | undefined = undefined,
TDynamic extends boolean = false,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
TExcludedMethods extends string = never,
> extends QueryPromise<TReturning extends undefined ? GelQueryResultKind<TQueryResult, never> : TReturning[]>
implements
RunnableQuery<TReturning extends undefined ? GelQueryResultKind<TQueryResult, never> : TReturning[], 'gel'>,
SQLWrapper
{
static override readonly [entityKind]: string = 'GelDelete';
private config: GelDeleteConfig;
constructor(
table: TTable,
private session: GelSession,
private dialect: GelDialect,
withList?: Subquery[],
) {
super();
this.config = { table, withList };
}
/**
* Adds a `where` clause to the query.
*
* Calling this method will delete only those rows that fulfill a specified condition.
*
* See docs: {@link https://orm.drizzle.team/docs/delete}
*
* @param where the `where` clause.
*
* @example
* You can use conditional operators and `sql function` to filter the rows to be deleted.
*
* ```ts
* // Delete all cars with green color
* await db.delete(cars).where(eq(cars.color, 'green'));
* // or
* await db.delete(cars).where(sql`${cars.color} = 'green'`)
* ```
*
* You can logically combine conditional operators with `and()` and `or()` operators:
*
* ```ts
* // Delete all BMW cars with a green color
* await db.delete(cars).where(and(eq(cars.color, 'green'), eq(cars.brand, 'BMW')));
*
* // Delete all cars with the green or blue color
* await db.delete(cars).where(or(eq(cars.color, 'green'), eq(cars.color, 'blue')));
* ```
*/
where(where: SQL | undefined): GelDeleteWithout<this, TDynamic, 'where'> {
this.config.where = where;
return this as any;
}
/**
* Adds a `returning` clause to the query.
*
* Calling this method will return the specified fields of the deleted rows. If no fields are specified, all fields will be returned.
*
* See docs: {@link https://orm.drizzle.team/docs/delete#delete-with-return}
*
* @example
* ```ts
* // Delete all cars with the green color and return all fields
* const deletedCars: Car[] = await db.delete(cars)
* .where(eq(cars.color, 'green'))
* .returning();
*
* // Delete all cars with the green color and return only their id and brand fields
* const deletedCarsIdsAndBrands: { id: number, brand: string }[] = await db.delete(cars)
* .where(eq(cars.color, 'green'))
* .returning({ id: cars.id, brand: cars.brand });
* ```
*/
returning(): GelDeleteReturningAll<this, TDynamic>;
Domain
Source
Frequently Asked Questions
What is the GelDeleteBase class?
GelDeleteBase is a class in the drizzle-orm codebase, defined in drizzle-orm/src/gel-core/query-builders/delete.ts.
Where is GelDeleteBase defined?
GelDeleteBase is defined in drizzle-orm/src/gel-core/query-builders/delete.ts at line 120.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free