import type { ColumnInfo } from '../types/adapter.js'; export interface GenerateContext { overrides?: Record; rule?: any; rowContext?: Record; /** * v4.0.3.2 Bug #17 fix: 主键列名集合(由 databaseService 从 tableInfo.primaryKeys 传入)。 * generator 据此识别 PK 列,对不同类型主键采用不同生成策略: * - IDENTITY 自增 PK (column.autoIncrement=true): 跳过,让 DB 自填 * - UUID/CHAR(36) PK: 生成 uuid v4 * - 其他 PK: 用 context.maxIntPkValues[pkName] (databaseService 提前查的 MAX(pk)) * + rowIndex + 1 作为 sequence,避免主键冲突 */ primaryKeys?: Set | string[]; /** * v4.0.3.2 Bug #17 fix: 非 IDENTITY INT PK 列的当前 MAX 值。 * 由 databaseService 在生成前查 `SELECT MAX(pk) FROM table` 注入。 * 序列从 maxValue + rowIndex + 1 开始,既不冲突也真实。 */ maxIntPkValues?: Record; } export declare class SampleDataGenerator { private faker; private sequenceCounter; private rngSeed; constructor(options?: { seed?: number; }); /** * Generate a value for a single column. * * v4.0.3.2 Bug #17 fix: PK 列处理策略 * - column.autoIncrement === true → 跳过(IDENTITY 自增,DB 自填) * - context.primaryKeys 包含 column.name 且 column 类型是 UUID/CHAR(36) → faker.string.uuid() * - 其他 PK → sequence int(避免 unique constraint violation) * 非 PK 列走原 heuristic + fallbackByType 路径。 */ generateValue(column: ColumnInfo, context?: GenerateContext, rowIndex?: number): unknown; /** * v5.0.1 Bug N14: 从列类型提取最大长度,截断超长字符串。 * 之前 `fallbackByType` 对所有字符串类型一律返回 `faker.lorem.sentence()`(~70+ 字符), * 直接超过 `VARCHAR(20)` 等短列宽,MySQL/PG 报 "Data too long"。 */ private truncateByColumnType; /** 从 column.type 提取 (N) 中的 N,没有显式长度返回 null(无限制)。 */ private extractMaxLen; private applyRule; private callFakerMethod; private matchHeuristic; private fallbackByType; } //# sourceMappingURL=sample-data-generator.d.ts.map