MCPcopy
hub / github.com/drizzle-team/drizzle-orm / onMutate

Method onMutate

drizzle-orm/src/cache/upstash/cache.ts:191–198  ·  view source on GitHub ↗
(params: MutationOption)

Source from the content-addressed store, hash-verified

189 }
190
191 override async onMutate(params: MutationOption) {
192 const tags = Array.isArray(params.tags) ? params.tags : params.tags ? [params.tags] : [];
193 const tables = Array.isArray(params.tables) ? params.tables : params.tables ? [params.tables] : [];
194 const tableNames: string[] = tables.map((table) => is(table, Table) ? table[OriginalName] : table as string);
195
196 const compositeTableSets = tableNames.map((table) => this.addTablePrefix(table));
197 await this.luaScripts.onMutateScript.exec([UpstashCache.tagsMapKey, ...compositeTableSets], tags);
198 }
199
200 private addTablePrefix = (table: string) => `${UpstashCache.compositeTableSetPrefix}${table}`;
201 private getCompositeKey = (tables: string[]) => `${UpstashCache.compositeTablePrefix}${tables.sort().join(',')}`;

Callers

nothing calls this directly

Calls 2

isFunction · 0.90
execMethod · 0.80

Tested by

no test coverage detected