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

mapUpdateSet() — drizzle-orm Function Reference

Architecture documentation for the mapUpdateSet() function in utils.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  8f976d74_38e7_6a63_ed00_d2b87643ee94["mapUpdateSet()"]
  99737bc3_a631_a054_9291_f966c791930f["utils.ts"]
  8f976d74_38e7_6a63_ed00_d2b87643ee94 -->|defined in| 99737bc3_a631_a054_9291_f966c791930f
  c020d230_75a2_3639_d9a6_35f2ba7fd5bc["is()"]
  8f976d74_38e7_6a63_ed00_d2b87643ee94 -->|calls| c020d230_75a2_3639_d9a6_35f2ba7fd5bc
  style 8f976d74_38e7_6a63_ed00_d2b87643ee94 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-orm/src/utils.ts lines 115–132

export function mapUpdateSet(table: Table, values: Record<string, unknown>): UpdateSet {
	const entries: [string, UpdateSet[string]][] = Object.entries(values)
		.filter(([, value]) => value !== undefined)
		.map(([key, value]) => {
			// eslint-disable-next-line unicorn/prefer-ternary
			if (is(value, SQL) || is(value, Column)) {
				return [key, value];
			} else {
				return [key, new Param(value, table[Table.Symbol.Columns][key])];
			}
		});

	if (entries.length === 0) {
		throw new Error('No values to set');
	}

	return Object.fromEntries(entries);
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does mapUpdateSet() do?
mapUpdateSet() is a function in the drizzle-orm codebase, defined in drizzle-orm/src/utils.ts.
Where is mapUpdateSet() defined?
mapUpdateSet() is defined in drizzle-orm/src/utils.ts at line 115.
What does mapUpdateSet() call?
mapUpdateSet() calls 1 function(s): is.

Analyze Your Own Codebase

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

Try Supermodel Free