GenerateLine Class — drizzle-orm Architecture
Architecture documentation for the GenerateLine class in Generators.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD f8854caa_b123_bbb1_c599_c55f6c26fcba["GenerateLine"] e5cee001_0354_7e76_ef0a_06dca71dc8ce["Generators.ts"] f8854caa_b123_bbb1_c599_c55f6c26fcba -->|defined in| e5cee001_0354_7e76_ef0a_06dca71dc8ce 61fac28d_598b_66b0_86c3_78cabf989dce["init()"] f8854caa_b123_bbb1_c599_c55f6c26fcba -->|method| 61fac28d_598b_66b0_86c3_78cabf989dce 6255ba91_a5fe_8a61_402b_8f02c5ba196d["generate()"] f8854caa_b123_bbb1_c599_c55f6c26fcba -->|method| 6255ba91_a5fe_8a61_402b_8f02c5ba196d
Relationship Graph
Source Code
drizzle-seed/src/services/Generators.ts lines 2980–3050
export class GenerateLine extends AbstractGenerator<{
isUnique?: boolean;
minAValue?: number;
maxAValue?: number;
minBValue?: number;
maxBValue?: number;
minCValue?: number;
maxCValue?: number;
arraySize?: number;
}> {
static override readonly entityKind: string = 'GenerateLine';
private state: {
aCoefficientGen: GenerateNumber;
bCoefficientGen: GenerateNumber;
cCoefficientGen: GenerateNumber;
} | undefined;
override uniqueVersionOfGen = GenerateUniqueLine;
override init({ count, seed }: { count: number; seed: number }) {
super.init({ count, seed });
const aCoefficientGen = new GenerateNumber({
minValue: this.params.minAValue,
maxValue: this.params.maxAValue,
precision: 10,
});
aCoefficientGen.init({ count, seed });
const bCoefficientGen = new GenerateNumber({
minValue: this.params.minBValue,
maxValue: this.params.maxBValue,
precision: 10,
});
bCoefficientGen.init({ count, seed });
const cCoefficientGen = new GenerateNumber({
minValue: this.params.minCValue,
maxValue: this.params.maxCValue,
precision: 10,
});
cCoefficientGen.init({ count, seed });
this.state = { aCoefficientGen, bCoefficientGen, cCoefficientGen };
}
generate() {
if (this.state === undefined) {
throw new Error('state is not defined.');
}
let b: number;
const a = this.state.aCoefficientGen.generate();
b = this.state.bCoefficientGen.generate();
while (a === 0 && b === 0) {
b = this.state.bCoefficientGen.generate();
}
const c = this.state.cCoefficientGen.generate();
if (this.dataType === 'json') {
return { a, b, c };
} else if (this.dataType === 'string') {
return `[${a}, ${b}, ${c}]`;
} else {
// if (this.dataType === "array")
return [a, b, c];
}
}
}
Domain
Defined In
Source
Frequently Asked Questions
What is the GenerateLine class?
GenerateLine is a class in the drizzle-orm codebase, defined in drizzle-seed/src/services/Generators.ts.
Where is GenerateLine defined?
GenerateLine is defined in drizzle-seed/src/services/Generators.ts at line 2980.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free