SQLiteDeleteBase Class — drizzle-orm Architecture
Architecture documentation for the SQLiteDeleteBase class in delete.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD a471a882_6081_4e4c_2ea3_c3ac37ea807a["SQLiteDeleteBase"] 6f3625a2_cc6b_d606_03e5_18263363651e["delete.ts"] a471a882_6081_4e4c_2ea3_c3ac37ea807a -->|defined in| 6f3625a2_cc6b_d606_03e5_18263363651e 175a2c79_742d_bb47_c7fb_aa4077566b9d["constructor()"] a471a882_6081_4e4c_2ea3_c3ac37ea807a -->|method| 175a2c79_742d_bb47_c7fb_aa4077566b9d 9811bc0a_dcd6_94d5_6502_151e5185ee10["where()"] a471a882_6081_4e4c_2ea3_c3ac37ea807a -->|method| 9811bc0a_dcd6_94d5_6502_151e5185ee10 1e38d0db_0e12_7798_501a_efce7910b99b["orderBy()"] a471a882_6081_4e4c_2ea3_c3ac37ea807a -->|method| 1e38d0db_0e12_7798_501a_efce7910b99b e0aad440_1a45_2e49_a0b3_de40d103da2b["limit()"] a471a882_6081_4e4c_2ea3_c3ac37ea807a -->|method| e0aad440_1a45_2e49_a0b3_de40d103da2b f847989a_5e6b_47fe_1c72_bf652c437d24["returning()"] a471a882_6081_4e4c_2ea3_c3ac37ea807a -->|method| f847989a_5e6b_47fe_1c72_bf652c437d24 4a413213_c3f1_999c_90bd_a5f32cf08df5["getSQL()"] a471a882_6081_4e4c_2ea3_c3ac37ea807a -->|method| 4a413213_c3f1_999c_90bd_a5f32cf08df5 89d11396_a401_18b8_1b40_dd262a60719f["toSQL()"] a471a882_6081_4e4c_2ea3_c3ac37ea807a -->|method| 89d11396_a401_18b8_1b40_dd262a60719f 4332457d_bf9f_339a_ebf9_293515c7522c["_prepare()"] a471a882_6081_4e4c_2ea3_c3ac37ea807a -->|method| 4332457d_bf9f_339a_ebf9_293515c7522c b17c6fd9_3b03_073c_60a5_207db764fa2c["prepare()"] a471a882_6081_4e4c_2ea3_c3ac37ea807a -->|method| b17c6fd9_3b03_073c_60a5_207db764fa2c 8a312120_581a_0b9c_bb9c_c00aa126202f["execute()"] a471a882_6081_4e4c_2ea3_c3ac37ea807a -->|method| 8a312120_581a_0b9c_bb9c_c00aa126202f 58a1750b_9dcd_708f_0f9b_927f02b7a569["$dynamic()"] a471a882_6081_4e4c_2ea3_c3ac37ea807a -->|method| 58a1750b_9dcd_708f_0f9b_927f02b7a569
Relationship Graph
Source Code
drizzle-orm/src/sqlite-core/query-builders/delete.ts lines 132–307
export class SQLiteDeleteBase<
TTable extends SQLiteTable,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
TResultType extends 'sync' | 'async',
TRunResult,
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 ? TRunResult : TReturning[]>
implements RunnableQuery<TReturning extends undefined ? TRunResult : TReturning[], 'sqlite'>, SQLWrapper
{
static override readonly [entityKind]: string = 'SQLiteDelete';
/** @internal */
config: SQLiteDeleteConfig;
constructor(
private table: TTable,
private session: SQLiteSession<any, any, any, any>,
private dialect: SQLiteDialect,
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
* db.delete(cars).where(eq(cars.color, 'green'));
* // or
* 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
* db.delete(cars).where(and(eq(cars.color, 'green'), eq(cars.brand, 'BMW')));
*
* // Delete all cars with the green or blue color
* db.delete(cars).where(or(eq(cars.color, 'green'), eq(cars.color, 'blue')));
* ```
*/
where(where: SQL | undefined): SQLiteDeleteWithout<this, TDynamic, 'where'> {
this.config.where = where;
return this as any;
}
orderBy(
builder: (deleteTable: TTable) => ValueOrArray<SQLiteColumn | SQL | SQL.Aliased>,
): SQLiteDeleteWithout<this, TDynamic, 'orderBy'>;
orderBy(...columns: (SQLiteColumn | SQL | SQL.Aliased)[]): SQLiteDeleteWithout<this, TDynamic, 'orderBy'>;
orderBy(
...columns:
| [(deleteTable: TTable) => ValueOrArray<SQLiteColumn | SQL | SQL.Aliased>]
| (SQLiteColumn | SQL | SQL.Aliased)[]
): SQLiteDeleteWithout<this, TDynamic, 'orderBy'> {
if (typeof columns[0] === 'function') {
const orderBy = columns[0](
new Proxy(
this.config.table[Table.Symbol.Columns],
new SelectionProxyHandler({ sqlAliasedBehavior: 'alias', sqlBehavior: 'sql' }),
) as any,
);
const orderByArray = Array.isArray(orderBy) ? orderBy : [orderBy];
this.config.orderBy = orderByArray;
} else {
Domain
Source
Frequently Asked Questions
What is the SQLiteDeleteBase class?
SQLiteDeleteBase is a class in the drizzle-orm codebase, defined in drizzle-orm/src/sqlite-core/query-builders/delete.ts.
Where is SQLiteDeleteBase defined?
SQLiteDeleteBase is defined in drizzle-orm/src/sqlite-core/query-builders/delete.ts at line 132.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free