onMutate() — drizzle-orm Function Reference
Architecture documentation for the onMutate() function in pg-common-cache.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 7f134d68_8067_d712_dd1e_a5e7cfd0f781["onMutate()"] d43d88d6_c6b6_386d_d59b_76b8db53bf29["TestGlobalCache"] 7f134d68_8067_d712_dd1e_a5e7cfd0f781 -->|defined in| d43d88d6_c6b6_386d_d59b_76b8db53bf29 style 7f134d68_8067_d712_dd1e_a5e7cfd0f781 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
integration-tests/tests/pg/pg-common-cache.ts lines 44–69
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
Source
Frequently Asked Questions
What does onMutate() do?
onMutate() is a function in the drizzle-orm codebase, defined in integration-tests/tests/pg/pg-common-cache.ts.
Where is onMutate() defined?
onMutate() is defined in integration-tests/tests/pg/pg-common-cache.ts at line 44.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free