GelUpdateBase Class — drizzle-orm Architecture
Architecture documentation for the GelUpdateBase class in update.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 40e4076c_05d5_c280_7940_f08e5d3868d9["GelUpdateBase"] 956cc921_a752_6eef_2068_90c91a3cc0a7["update.ts"] 40e4076c_05d5_c280_7940_f08e5d3868d9 -->|defined in| 956cc921_a752_6eef_2068_90c91a3cc0a7 45f41301_6f8e_7394_219b_2d318a644250["constructor()"] 40e4076c_05d5_c280_7940_f08e5d3868d9 -->|method| 45f41301_6f8e_7394_219b_2d318a644250 41dc55fd_303c_0355_58eb_f68316dcbd26["from()"] 40e4076c_05d5_c280_7940_f08e5d3868d9 -->|method| 41dc55fd_303c_0355_58eb_f68316dcbd26 3238fc0a_15c3_86c0_b18e_e49c5f970a96["getTableLikeFields()"] 40e4076c_05d5_c280_7940_f08e5d3868d9 -->|method| 3238fc0a_15c3_86c0_b18e_e49c5f970a96 e4cd8719_9e69_dac2_e0b4_723ac029103b["createJoin()"] 40e4076c_05d5_c280_7940_f08e5d3868d9 -->|method| e4cd8719_9e69_dac2_e0b4_723ac029103b 0425f68d_d766_b1e2_baba_6ad39f659fb3["where()"] 40e4076c_05d5_c280_7940_f08e5d3868d9 -->|method| 0425f68d_d766_b1e2_baba_6ad39f659fb3 889e5450_39ed_97c7_0946_a02bfedddecf["returning()"] 40e4076c_05d5_c280_7940_f08e5d3868d9 -->|method| 889e5450_39ed_97c7_0946_a02bfedddecf 32c31339_781d_a35c_bf9a_2d5da944b406["getSQL()"] 40e4076c_05d5_c280_7940_f08e5d3868d9 -->|method| 32c31339_781d_a35c_bf9a_2d5da944b406 d8ffd049_f530_2f99_67d7_9d0a5d8fd925["toSQL()"] 40e4076c_05d5_c280_7940_f08e5d3868d9 -->|method| d8ffd049_f530_2f99_67d7_9d0a5d8fd925 84394122_beb5_4447_ef69_0eea00ec05f0["_prepare()"] 40e4076c_05d5_c280_7940_f08e5d3868d9 -->|method| 84394122_beb5_4447_ef69_0eea00ec05f0 cd26119d_8fb9_5c3e_7a30_28291a8b1811["prepare()"] 40e4076c_05d5_c280_7940_f08e5d3868d9 -->|method| cd26119d_8fb9_5c3e_7a30_28291a8b1811 b5758d8b_ed05_aa49_01c6_fc26793dddc6["$dynamic()"] 40e4076c_05d5_c280_7940_f08e5d3868d9 -->|method| b5758d8b_ed05_aa49_01c6_fc26793dddc6
Relationship Graph
Source Code
drizzle-orm/src/gel-core/query-builders/update.ts lines 308–561
export class GelUpdateBase<
TTable extends GelTable,
TQueryResult extends GelQueryResultHKT,
TFrom extends GelTable | Subquery | GelViewBase | SQL | undefined = undefined,
TReturning extends Record<string, unknown> | undefined = undefined,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
TNullabilityMap extends Record<string, JoinNullability> = Record<TTable['_']['name'], 'not-null'>,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
TJoins extends Join[] = [],
// 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 ? GelQueryResultKind<TQueryResult, never> : TReturning[]>
implements
RunnableQuery<TReturning extends undefined ? GelQueryResultKind<TQueryResult, never> : TReturning[], 'gel'>,
SQLWrapper
{
static override readonly [entityKind]: string = 'GelUpdate';
private config: GelUpdateConfig;
private tableName: string | undefined;
private joinsNotNullableMap: Record<string, boolean>;
constructor(
table: TTable,
set: UpdateSet,
private session: GelSession,
private dialect: GelDialect,
withList?: Subquery[],
) {
super();
this.config = { set, table, withList, joins: [] };
this.tableName = getTableLikeName(table);
this.joinsNotNullableMap = typeof this.tableName === 'string' ? { [this.tableName]: true } : {};
}
from<TFrom extends GelTable | Subquery | GelViewBase | SQL>(
source: TFrom,
): GelUpdateWithJoins<this, TDynamic, TFrom> {
const tableName = getTableLikeName(source);
if (typeof tableName === 'string') {
this.joinsNotNullableMap[tableName] = true;
}
this.config.from = source;
return this as any;
}
private getTableLikeFields(table: GelTable | Subquery | GelViewBase): Record<string, unknown> {
if (is(table, GelTable)) {
return table[Table.Symbol.Columns];
} else if (is(table, Subquery)) {
return table._.selectedFields;
}
return table[ViewBaseConfig].selectedFields;
}
private createJoin<TJoinType extends JoinType>(
joinType: TJoinType,
): GelUpdateJoinFn<this, TDynamic, TJoinType> {
return ((
table: GelTable | Subquery | GelViewBase | 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(this.config.from, SQL)
? this.getTableLikeFields(this.config.from)
: undefined;
on = on(
new Proxy(
this.config.table[Table.Symbol.Columns],
new SelectionProxyHandler({ sqlAliasedBehavior: 'sql', sqlBehavior: 'sql' }),
) as any,
from && new Proxy(
from,
Domain
Source
Frequently Asked Questions
What is the GelUpdateBase class?
GelUpdateBase is a class in the drizzle-orm codebase, defined in drizzle-orm/src/gel-core/query-builders/update.ts.
Where is GelUpdateBase defined?
GelUpdateBase is defined in drizzle-orm/src/gel-core/query-builders/update.ts at line 308.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free