/** * 解析单行 CSV (不含末尾换行符)。 * 返回 (string | null)[] — 命中 nullStrings 的字段为 null。 */ export declare function parseCsvLine(line: string, nullStrings?: Set): (string | null)[]; /** * 流式 CSV 行迭代器:输入 ReadableStream,产出 header + rows。 * streamCsvRows 已经剥离 header,直接 yield 数据行(每行 keys = header 列名) */ export declare function streamCsvRows(input: NodeJS.ReadableStream, opts?: { hasHeader?: boolean; nullStrings?: Set; }): AsyncIterableIterator>; /** * v3.3: 把对象数组 batch 转成 adapter 期望的形状。 * - SQLite (`config.type === 'sqlite'`): 用 `?` 顺序 placeholder,需 raw value 数组。 * - 其他 (CH/DM/MySQL/PG/...): 用 `{col:Type}` named placeholder,需对象数组 * (Bug #54 已修 — 对象数组会被自动当 query_params 用) */ export declare function _toAdapterBatch(pendingBatch: Array>, adapter: { config?: { type?: string; }; }, tableColumnNames: string[]): unknown; /** * 从 CSV 文件导入到已存在的表 (APPEND 模式)。 * * 流程: * 1. getTableInfo(table) 校验表存在, 取列定义 (兼容 SQLite {tableInfo} 与 CH 直接返回) * 2. streamCsvRows 读 header + rows (流式, 跨 chunk 正确处理) * 3. columns 显式覆盖 → CSV 列映射到表列; 否则按 CSV header 自动匹配 * 4. 校验 CSV 列 ⊆ table.columns, 缺失列抛 column_mismatch * 5. 累积 batchSize 行 → adapter.executeBatch(INSERT INTO ..., rows, useTransaction: false) * SQLite 用 raw 数组 + ? placeholder, 其他用对象数组 + named placeholder * 6. dryRun=true 时不调 executeBatch, 返回 sample 前 5 行 + totalRows */ export declare function importCsv(opts: { adapter: { executeBatch(sql: string, paramsList: unknown, options?: any): Promise<{ totalAffectedRows?: number; affectedRowsPerStatement?: number[]; }>; executeQuery(sql: string): Promise<{ rows: unknown[]; }>; getTableInfo(name: string): Promise<{ name: string; schema?: string | null; columns: Array<{ name: string; type: string; nullable?: boolean; }>; }>; }; table: string; filePath: string; columns?: string[]; hasHeader?: boolean; batchSize?: number; nullStrings?: Set; dryRun?: boolean; }): Promise<{ totalRows: number; batches: number; durationMs: number; errors?: string[]; sample?: Record[]; }>; //# sourceMappingURL=csv-reader.d.ts.map