SingleStoreUpdateBase Class — drizzle-orm Architecture
Architecture documentation for the SingleStoreUpdateBase class in update.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD e8ae715e_b65b_b0b9_a755_051bc127c6e5["SingleStoreUpdateBase"] 64096455_7280_542c_f914_37d4fc92062b["update.ts"] e8ae715e_b65b_b0b9_a755_051bc127c6e5 -->|defined in| 64096455_7280_542c_f914_37d4fc92062b 7f929387_ed71_056d_a262_d947793fb79a["constructor()"] e8ae715e_b65b_b0b9_a755_051bc127c6e5 -->|method| 7f929387_ed71_056d_a262_d947793fb79a 48de9c6b_7b8a_018a_63e5_19607505c7d1["where()"] e8ae715e_b65b_b0b9_a755_051bc127c6e5 -->|method| 48de9c6b_7b8a_018a_63e5_19607505c7d1 f9f3c2b5_7543_7a95_8a62_7a897bb71327["orderBy()"] e8ae715e_b65b_b0b9_a755_051bc127c6e5 -->|method| f9f3c2b5_7543_7a95_8a62_7a897bb71327 cb367880_2042_aee4_c1ac_f41d76a946c4["limit()"] e8ae715e_b65b_b0b9_a755_051bc127c6e5 -->|method| cb367880_2042_aee4_c1ac_f41d76a946c4 9e8c4df0_e9f3_3223_112f_d1eb6bd33cc8["getSQL()"] e8ae715e_b65b_b0b9_a755_051bc127c6e5 -->|method| 9e8c4df0_e9f3_3223_112f_d1eb6bd33cc8 3e96e582_285d_e98d_2404_76247f46c53d["toSQL()"] e8ae715e_b65b_b0b9_a755_051bc127c6e5 -->|method| 3e96e582_285d_e98d_2404_76247f46c53d af985441_908d_217d_b604_e1bf41c9b00e["prepare()"] e8ae715e_b65b_b0b9_a755_051bc127c6e5 -->|method| af985441_908d_217d_b604_e1bf41c9b00e 5358f726_9da4_7c86_0b22_8f4953b93f6c["$dynamic()"] e8ae715e_b65b_b0b9_a755_051bc127c6e5 -->|method| 5358f726_9da4_7c86_0b22_8f4953b93f6c
Relationship Graph
Source Code
drizzle-orm/src/singlestore-core/query-builders/update.ts lines 126–260
export class SingleStoreUpdateBase<
TTable extends SingleStoreTable,
TQueryResult extends SingleStoreQueryResultHKT,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
TPreparedQueryHKT extends PreparedQueryHKTBase,
// 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<SingleStoreQueryResultKind<TQueryResult, never>> implements SQLWrapper {
static override readonly [entityKind]: string = 'SingleStoreUpdate';
private config: SingleStoreUpdateConfig;
constructor(
table: TTable,
set: UpdateSet,
private session: SingleStoreSession,
private dialect: SingleStoreDialect,
withList?: Subquery[],
) {
super();
this.config = { set, table, withList };
}
/**
* Adds a 'where' clause to the query.
*
* Calling this method will update only those rows that fulfill a specified condition.
*
* See docs: {@link https://orm.drizzle.team/docs/update}
*
* @param where the 'where' clause.
*
* @example
* You can use conditional operators and `sql function` to filter the rows to be updated.
*
* ```ts
* // Update all cars with green color
* db.update(cars).set({ color: 'red' })
* .where(eq(cars.color, 'green'));
* // or
* db.update(cars).set({ color: 'red' })
* .where(sql`${cars.color} = 'green'`)
* ```
*
* You can logically combine conditional operators with `and()` and `or()` operators:
*
* ```ts
* // Update all BMW cars with a green color
* db.update(cars).set({ color: 'red' })
* .where(and(eq(cars.color, 'green'), eq(cars.brand, 'BMW')));
*
* // Update all cars with the green or blue color
* db.update(cars).set({ color: 'red' })
* .where(or(eq(cars.color, 'green'), eq(cars.color, 'blue')));
* ```
*/
where(where: SQL | undefined): SingleStoreUpdateWithout<this, TDynamic, 'where'> {
this.config.where = where;
return this as any;
}
orderBy(
builder: (updateTable: TTable) => ValueOrArray<SingleStoreColumn | SQL | SQL.Aliased>,
): SingleStoreUpdateWithout<this, TDynamic, 'orderBy'>;
orderBy(...columns: (SingleStoreColumn | SQL | SQL.Aliased)[]): SingleStoreUpdateWithout<this, TDynamic, 'orderBy'>;
orderBy(
...columns:
| [(updateTable: TTable) => ValueOrArray<SingleStoreColumn | SQL | SQL.Aliased>]
| (SingleStoreColumn | SQL | SQL.Aliased)[]
): SingleStoreUpdateWithout<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];
Domain
Source
Frequently Asked Questions
What is the SingleStoreUpdateBase class?
SingleStoreUpdateBase is a class in the drizzle-orm codebase, defined in drizzle-orm/src/singlestore-core/query-builders/update.ts.
Where is SingleStoreUpdateBase defined?
SingleStoreUpdateBase is defined in drizzle-orm/src/singlestore-core/query-builders/update.ts at line 126.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free