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 cb636946_9882_5bc3_0c43_b2ac96e2bfa2["onMutate()"] e05ddf34_e540_3dd3_73ba_c3b5627a61cd["TestGlobalCache"] cb636946_9882_5bc3_0c43_b2ac96e2bfa2 -->|defined in| e05ddf34_e540_3dd3_73ba_c3b5627a61cd style cb636946_9882_5bc3_0c43_b2ac96e2bfa2 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
integration-tests/tests/gel/cache.ts lines 40–65
override async onMutate(params: MutationOption): Promise<void> {
const tagsArray = params.tags ? Array.isArray(params.tags) ? params.tags : [params.tags] : [];
const tablesArray = params.tables ? Array.isArray(params.tables) ? params.tables : [params.tables] : [];
const keysToDelete = new Set<string>();
for (const table of tablesArray) {
const tableName = is(table, Table) ? getTableName(table) : table as string;
const keys = this.usedTablesPerKey[tableName] ?? [];
for (const key of keys) keysToDelete.add(key);
}
if (keysToDelete.size > 0 || tagsArray.length > 0) {
for (const tag of tagsArray) {
await this.kv.delete(tag);
}
for (const key of keysToDelete) {
await this.kv.delete(key);
for (const table of tablesArray) {
const tableName = is(table, Table) ? getTableName(table) : table as string;
this.usedTablesPerKey[tableName] = [];
}
}
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does onMutate() do?
onMutate() is a function in the drizzle-orm codebase, defined in integration-tests/tests/gel/cache.ts.
Where is onMutate() defined?
onMutate() is defined in integration-tests/tests/gel/cache.ts at line 40.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free