Home / Function/ buildUpdateSet() — drizzle-orm Function Reference

buildUpdateSet() — drizzle-orm Function Reference

Architecture documentation for the buildUpdateSet() function in driver.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  9ca3f186_3e17_ec9a_7b09_ad335182ed6e["buildUpdateSet()"]
  182ab2de_01f7_1a78_b6ab_f77a214a8559["AwsPgDialect"]
  9ca3f186_3e17_ec9a_7b09_ad335182ed6e -->|defined in| 182ab2de_01f7_1a78_b6ab_f77a214a8559
  style 9ca3f186_3e17_ec9a_7b09_ad335182ed6e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-orm/src/aws-data-api/pg/driver.ts lines 79–92

	override buildUpdateSet(table: PgTable<TableConfig>, set: UpdateSet): SQL<unknown> {
		const columns: Record<string, PgColumn> = table[Table.Symbol.Columns];

		for (const [colName, colValue] of Object.entries(set)) {
			const currentColumn = columns[colName];
			if (
				currentColumn && is(colValue, Param) && colValue.value !== undefined && is(colValue.encoder, PgArray)
				&& Array.isArray(colValue.value)
			) {
				set[colName] = sql`cast(${colValue} as ${sql.raw(colValue.encoder.getSQLType())})`;
			}
		}
		return super.buildUpdateSet(table, set);
	}

Domain

Subdomains

Frequently Asked Questions

What does buildUpdateSet() do?
buildUpdateSet() is a function in the drizzle-orm codebase, defined in drizzle-orm/src/aws-data-api/pg/driver.ts.
Where is buildUpdateSet() defined?
buildUpdateSet() is defined in drizzle-orm/src/aws-data-api/pg/driver.ts at line 79.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free