bun-sqlite/dist/utils/sql-generator-grab-concat-str.js
2026-04-18 15:27:25 +01:00

14 lines
316 B
JavaScript

export default function sqlGenGrabConcatStr({ alias, field, separator = ",", distinct, }) {
let gc = `GROUP_CONCAT(`;
if (distinct) {
gc += `DISTINCT `;
}
gc += `${field}'`;
if (!distinct) {
gc += `, '${separator}`;
}
gc += `)`;
gc += ` AS ${alias}`;
return gc;
}