generate() — drizzle-orm Function Reference
Architecture documentation for the generate() function in Generators.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD b51e59e1_f7e1_e692_d984_f4e8dae2e50d["generate()"] dc015a24_3620_97c4_4fea_d3bbba712474["GenerateInt"] b51e59e1_f7e1_e692_d984_f4e8dae2e50d -->|defined in| dc015a24_3620_97c4_4fea_d3bbba712474 style b51e59e1_f7e1_e692_d984_f4e8dae2e50d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-seed/src/services/Generators.ts lines 612–640
generate() {
if (this.state === undefined) {
throw new Error('state is not defined.');
}
let value: number | bigint;
if (typeof this.state.minValue === 'bigint' && typeof this.state.maxValue === 'bigint') {
[value, this.state.rng] = prand.uniformBigIntDistribution(
this.state.minValue,
this.state.maxValue,
this.state.rng,
);
} else {
[value, this.state.rng] = prand.uniformIntDistribution(
this.state.minValue as number,
this.state.maxValue as number,
this.state.rng,
);
}
if (this.dataType === 'string') {
return String(value);
}
if (this.dataType === 'bigint') {
value = BigInt(value);
}
return value;
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does generate() do?
generate() is a function in the drizzle-orm codebase, defined in drizzle-seed/src/services/Generators.ts.
Where is generate() defined?
generate() is defined in drizzle-seed/src/services/Generators.ts at line 612.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free