This commit is contained in:
2026-01-09 12:59:05 +01:00
parent a10524da95
commit a915be704b
6 changed files with 17 additions and 5 deletions
@@ -27,6 +27,7 @@ type Param<T extends { [k: string]: any } = any> = {
debug?: boolean;
dbConfig?: ConnectionConfig;
whereClauseObject?: DsqlCrudParamWhereClause;
targetIds?: (string | number)[];
};
/**
@@ -49,6 +50,7 @@ export default async function updateDbEntry<
debug,
dbConfig,
whereClauseObject,
targetIds,
}: Param<T>): Promise<APIResponseObject<PostInsertReturn>> {
/**
* Check if data is valid
@@ -142,7 +144,10 @@ export default async function updateDbEntry<
isMaster && !dbFullName ? "" : `\`${dbFullName}\`.`
}\`${tableName}\` SET ${updateKeyValueArray.join(",")}`;
if (whereClauseObject) {
if (targetIds) {
query += ` WHERE id IN (${targetIds.map((id) => "?").join(",")})`;
updateValues = targetIds;
} else if (whereClauseObject) {
query += ` ${whereClauseObject.clause}`;
updateValues.push(...(whereClauseObject.params || []));
} else {