MCPcopy Create free account
hub / github.com/Shazbot/WH3-Mod-Manager / getExistingValuesForTableColumn

Function getExistingValuesForTableColumn

src/DBClone.ts:1224–1252  ·  view source on GitHub ↗
(tableName: string, columnName: string)

Source from the content-addressed store, hash-verified

1222
1223 const tableColumnValuesCache = new Map<string, Set<string>>();
1224 const getExistingValuesForTableColumn = async (tableName: string, columnName: string) => {
1225 const cacheKey = `${tableName}|${columnName}`;
1226 const existingCache = tableColumnValuesCache.get(cacheKey);
1227 if (existingCache) return existingCache;
1228
1229 const existingValues = new Set<string>();
1230 for (const targetPackPath of packPathsForCollisionChecks) {
1231 if (isCanceled()) {
1232 report("canceled", "Canceled");
1233 return existingValues;
1234 }
1235
1236 const tableFiles = await getTableFilesForPackAndTable(targetPackPath, tableName);
1237 for (const tableFile of tableFiles) {
1238 const columnIndex = getColumnIndexForPackedFile(tableFile, columnName);
1239 if (columnIndex < 0) continue;
1240
1241 const rows = getRowsForPackedFile(tableFile);
1242 for (const row of rows) {
1243 const cell = row[columnIndex];
1244 if (!cell) continue;
1245 existingValues.add(cell.resolvedKeyValue);
1246 }
1247 }
1248 }
1249
1250 tableColumnValuesCache.set(cacheKey, existingValues);
1251 return existingValues;
1252 };
1253
1254 interface SavePackedFileDataWithSchema {
1255 name: string;

Callers 2

executeDBDuplicationFunction · 0.85
createUniqueNumericIdFunction · 0.85

Calls 7

isCanceledFunction · 0.85
reportFunction · 0.85
getRowsForPackedFileFunction · 0.70
getMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected