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