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

onMutate() — drizzle-orm Function Reference

Architecture documentation for the onMutate() function in cache.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  4548e6ce_bedc_ec09_3adb_957a67415b1c["onMutate()"]
  418ebf5b_65ad_1cd4_79ba_2c99e874ea49["UpstashCache"]
  4548e6ce_bedc_ec09_3adb_957a67415b1c -->|defined in| 418ebf5b_65ad_1cd4_79ba_2c99e874ea49
  style 4548e6ce_bedc_ec09_3adb_957a67415b1c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-orm/src/cache/upstash/cache.ts lines 191–198

	override async onMutate(params: MutationOption) {
		const tags = Array.isArray(params.tags) ? params.tags : params.tags ? [params.tags] : [];
		const tables = Array.isArray(params.tables) ? params.tables : params.tables ? [params.tables] : [];
		const tableNames: string[] = tables.map((table) => is(table, Table) ? table[OriginalName] : table as string);

		const compositeTableSets = tableNames.map((table) => this.addTablePrefix(table));
		await this.luaScripts.onMutateScript.exec([UpstashCache.tagsMapKey, ...compositeTableSets], tags);
	}

Domain

Subdomains

Frequently Asked Questions

What does onMutate() do?
onMutate() is a function in the drizzle-orm codebase, defined in drizzle-orm/src/cache/upstash/cache.ts.
Where is onMutate() defined?
onMutate() is defined in drizzle-orm/src/cache/upstash/cache.ts at line 191.

Analyze Your Own Codebase

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

Try Supermodel Free