Add more features to the query generator

This commit is contained in:
2026-04-18 14:59:23 +01:00
parent f3f1c42699
commit 9c5d39edfb
19 changed files with 375 additions and 83 deletions
+12 -1
View File
@@ -2,13 +2,24 @@ type Param = {
field: string;
alias: string;
separator?: string;
distinct?: boolean;
};
export default function sqlGenGrabConcatStr({
alias,
field,
separator = ",",
distinct,
}: Param) {
let gc = `GROUP_CONCAT(${field}, '${separator}') AS ${alias}`;
let gc = `GROUP_CONCAT(`;
if (distinct) {
gc += `DISTINCT `;
}
gc += `${field}, '${separator}'`;
gc += `)`;
gc += ` AS ${alias}`;
return gc;
}