import { sqlName, sqlStringLiteral } from "./sql-safe"; export default function sqlGenGrabConcatStr({ alias, field, separator = ",", distinct, }) { let gc = `GROUP_CONCAT(`; if (distinct) { gc += `DISTINCT `; } gc += field; if (!distinct) { gc += `, ${sqlStringLiteral(String(separator))}`; } gc += `)`; gc += ` AS ${sqlName(alias, "alias")}`; return gc; }