MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / formatAsCSV

Function formatAsCSV

src/utils/sqlExport.ts:13–19  ·  view source on GitHub ↗
(data: SQLExportData)

Source from the content-addressed store, hash-verified

11 * 将 SQL 结果格式化为 CSV
12 */
13export function formatAsCSV(data: SQLExportData): string {
14 const header = data.columns.join(',')
15 const rows = data.rows.map((row) =>
16 row.map((cell) => (cell === null ? '' : `"${String(cell).replace(/"/g, '""')}"`)).join(',')
17 )
18 return [header, ...rows].join('\n')
19}
20
21/**
22 * 将 SQL 结果格式化为 JSON(数组对象形式)

Callers 1

exportSQLResultFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected