GenerateCountry Class — drizzle-orm Architecture
Architecture documentation for the GenerateCountry class in Generators.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 356ec79b_f2c5_7623_3e85_5fa08aebce34["GenerateCountry"] e5cee001_0354_7e76_ef0a_06dca71dc8ce["Generators.ts"] 356ec79b_f2c5_7623_3e85_5fa08aebce34 -->|defined in| e5cee001_0354_7e76_ef0a_06dca71dc8ce c3c59f9c_d67c_7efe_f244_94199b67d22c["init()"] 356ec79b_f2c5_7623_3e85_5fa08aebce34 -->|method| c3c59f9c_d67c_7efe_f244_94199b67d22c 31c0434e_75a8_2e06_b2c5_381ec1621383["generate()"] 356ec79b_f2c5_7623_3e85_5fa08aebce34 -->|method| 31c0434e_75a8_2e06_b2c5_381ec1621383
Relationship Graph
Source Code
drizzle-seed/src/services/Generators.ts lines 2083–2120
export class GenerateCountry extends AbstractGenerator<{
isUnique?: boolean;
arraySize?: number;
}> {
static override readonly entityKind: string = 'GenerateCountry';
private state: {
rng: prand.RandomGenerator;
} | undefined;
override uniqueVersionOfGen = GenerateUniqueCountry;
override init({ count, seed }: { count: number; seed: number }) {
super.init({ count, seed });
const rng = prand.xoroshiro128plus(seed);
if (this.stringLength !== undefined && this.stringLength < maxCountryLength) {
throw new Error(
`You can't use country generator with a db column length restriction of ${this.stringLength}. Set the maximum string length to at least ${maxCountryLength}.`,
);
}
this.state = { rng };
}
generate() {
if (this.state === undefined) {
throw new Error('state is not defined.');
}
let idx: number;
[idx, this.state.rng] = prand.uniformIntDistribution(0, countries.length - 1, this.state.rng);
const country = countries[idx] as string;
return country;
}
}
Domain
Defined In
Source
Frequently Asked Questions
What is the GenerateCountry class?
GenerateCountry is a class in the drizzle-orm codebase, defined in drizzle-seed/src/services/Generators.ts.
Where is GenerateCountry defined?
GenerateCountry is defined in drizzle-seed/src/services/Generators.ts at line 2083.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free