generate() — drizzle-orm Function Reference
Architecture documentation for the generate() function in v2.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 5785a7c5_bd5d_0341_0c88_1df53ae29c8a["generate()"] edccb078_72bf_7593_a17b_79784ccdfa56["GenerateUniqueStringV2"] 5785a7c5_bd5d_0341_0c88_1df53ae29c8a -->|defined in| edccb078_72bf_7593_a17b_79784ccdfa56 style 5785a7c5_bd5d_0341_0c88_1df53ae29c8a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-seed/src/services/versioning/v2.ts lines 202–231
generate({ i }: { i: number }) {
if (this.state === undefined) {
throw new Error('state is not defined.');
}
const minStringLength = this.state.minStringLength,
maxStringLength = this.state.maxStringLength;
const stringChars = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
let idx: number,
strLength: number;
let currStr: string;
currStr = '';
const uniqueStr = i.toString(16);
[strLength, this.state.rng] = prand.uniformIntDistribution(
minStringLength,
maxStringLength - uniqueStr.length,
this.state.rng,
);
for (let j = 0; j < strLength - uniqueStr.length; j++) {
[idx, this.state.rng] = prand.uniformIntDistribution(
0,
stringChars.length - 1,
this.state.rng,
);
currStr += stringChars[idx];
}
return uniqueStr + currStr;
}
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/versioning/v2.ts.
Where is generate() defined?
generate() is defined in drizzle-seed/src/services/versioning/v2.ts at line 202.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free