SQLiteUpdateBase Class — drizzle-orm Architecture
Architecture documentation for the SQLiteUpdateBase class in update.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 2554514b_4610_9aed_e6d5_669cd23017c0["SQLiteUpdateBase"] 521e96ec_d755_9be7_bb0d_0c92d181f793["update.ts"] 2554514b_4610_9aed_e6d5_669cd23017c0 -->|defined in| 521e96ec_d755_9be7_bb0d_0c92d181f793 37dd6606_f1f6_4dfe_ae92_6e5cfb73236f["constructor()"] 2554514b_4610_9aed_e6d5_669cd23017c0 -->|method| 37dd6606_f1f6_4dfe_ae92_6e5cfb73236f 05e8f5f8_c1a4_cfef_1a4b_fd77f384064e["from()"] 2554514b_4610_9aed_e6d5_669cd23017c0 -->|method| 05e8f5f8_c1a4_cfef_1a4b_fd77f384064e 68a4a459_8363_98af_dca7_6d21e784553e["createJoin()"] 2554514b_4610_9aed_e6d5_669cd23017c0 -->|method| 68a4a459_8363_98af_dca7_6d21e784553e 4824e0e8_f6c2_f5b9_eb06_e5de3fc42b82["where()"] 2554514b_4610_9aed_e6d5_669cd23017c0 -->|method| 4824e0e8_f6c2_f5b9_eb06_e5de3fc42b82 a80aadbe_f1a5_ee06_c288_d143fd8c8c7c["orderBy()"] 2554514b_4610_9aed_e6d5_669cd23017c0 -->|method| a80aadbe_f1a5_ee06_c288_d143fd8c8c7c 47580eff_1b4d_94ef_a9fe_da417d39a1b3["limit()"] 2554514b_4610_9aed_e6d5_669cd23017c0 -->|method| 47580eff_1b4d_94ef_a9fe_da417d39a1b3 bd206ec9_79bc_9693_c12a_aa23611ccfa1["returning()"] 2554514b_4610_9aed_e6d5_669cd23017c0 -->|method| bd206ec9_79bc_9693_c12a_aa23611ccfa1 085785c8_fb97_3a56_bd03_d88e63049924["getSQL()"] 2554514b_4610_9aed_e6d5_669cd23017c0 -->|method| 085785c8_fb97_3a56_bd03_d88e63049924 62769419_3a8e_5550_17fc_426284ffa4f5["toSQL()"] 2554514b_4610_9aed_e6d5_669cd23017c0 -->|method| 62769419_3a8e_5550_17fc_426284ffa4f5 99891865_6c32_2250_e8dc_130a485cf796["_prepare()"] 2554514b_4610_9aed_e6d5_669cd23017c0 -->|method| 99891865_6c32_2250_e8dc_130a485cf796 955902fd_2cf1_71a1_4fcc_beee46bc55c6["prepare()"] 2554514b_4610_9aed_e6d5_669cd23017c0 -->|method| 955902fd_2cf1_71a1_4fcc_beee46bc55c6 4429569d_bb9f_655b_363d_54a1b2fc6bcb["execute()"] 2554514b_4610_9aed_e6d5_669cd23017c0 -->|method| 4429569d_bb9f_655b_363d_54a1b2fc6bcb ce97f0f1_27fd_c192_56e0_163ce49d8a94["$dynamic()"] 2554514b_4610_9aed_e6d5_669cd23017c0 -->|method| ce97f0f1_27fd_c192_56e0_163ce49d8a94
Relationship Graph
Source Code
drizzle-orm/src/sqlite-core/query-builders/update.ts lines 225–465
export class SQLiteUpdateBase<
TTable extends SQLiteTable = SQLiteTable,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
TResultType extends 'sync' | 'async' = 'sync' | 'async',
TRunResult = unknown,
TFrom extends SQLiteTable | Subquery | SQLiteViewBase | SQL | undefined = undefined,
TReturning = undefined,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
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 = 'SQLiteUpdate';
/** @internal */
config: SQLiteUpdateConfig;
constructor(
table: TTable,
set: UpdateSet,
private session: SQLiteSession<any, any, any, any>,
private dialect: SQLiteDialect,
withList?: Subquery[],
) {
super();
this.config = { set, table, withList, joins: [] };
}
from<TFrom extends SQLiteTable | Subquery | SQLiteViewBase | SQL>(
source: TFrom,
): SQLiteUpdateWithJoins<this, TDynamic, TFrom> {
this.config.from = source;
return this as any;
}
private createJoin<TJoinType extends JoinType>(
joinType: TJoinType,
): SQLiteUpdateJoinFn<this> {
return ((
table: SQLiteTable | Subquery | SQLiteViewBase | SQL,
on: ((updateTable: TTable, from: TFrom) => SQL | undefined) | SQL | undefined,
) => {
const tableName = getTableLikeName(table);
if (typeof tableName === 'string' && this.config.joins.some((join) => join.alias === tableName)) {
throw new Error(`Alias "${tableName}" is already used in this query`);
}
if (typeof on === 'function') {
const from = this.config.from
? is(table, SQLiteTable)
? table[Table.Symbol.Columns]
: is(table, Subquery)
? table._.selectedFields
: is(table, SQLiteViewBase)
? table[ViewBaseConfig].selectedFields
: undefined
: undefined;
on = on(
new Proxy(
this.config.table[Table.Symbol.Columns],
new SelectionProxyHandler({ sqlAliasedBehavior: 'sql', sqlBehavior: 'sql' }),
) as any,
from && new Proxy(
from,
new SelectionProxyHandler({ sqlAliasedBehavior: 'sql', sqlBehavior: 'sql' }),
) as any,
);
}
this.config.joins.push({ on, table, joinType, alias: tableName });
return this as any;
}) as any;
}
leftJoin = this.createJoin('left');
rightJoin = this.createJoin('right');
Domain
Source
Frequently Asked Questions
What is the SQLiteUpdateBase class?
SQLiteUpdateBase is a class in the drizzle-orm codebase, defined in drizzle-orm/src/sqlite-core/query-builders/update.ts.
Where is SQLiteUpdateBase defined?
SQLiteUpdateBase is defined in drizzle-orm/src/sqlite-core/query-builders/update.ts at line 225.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free