GenerateLoremIpsum Class — drizzle-orm Architecture
Architecture documentation for the GenerateLoremIpsum class in Generators.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 93d6c93c_2bec_4917_2153_2aadef00e84d["GenerateLoremIpsum"] e5cee001_0354_7e76_ef0a_06dca71dc8ce["Generators.ts"] 93d6c93c_2bec_4917_2153_2aadef00e84d -->|defined in| e5cee001_0354_7e76_ef0a_06dca71dc8ce 675e2546_a7cd_98dd_2c86_e5d5502472da["init()"] 93d6c93c_2bec_4917_2153_2aadef00e84d -->|method| 675e2546_a7cd_98dd_2c86_e5d5502472da 3c12a3eb_9db0_d383_fea0_7fc97810101e["generate()"] 93d6c93c_2bec_4917_2153_2aadef00e84d -->|method| 3c12a3eb_9db0_d383_fea0_7fc97810101e
Relationship Graph
Source Code
drizzle-seed/src/services/Generators.ts lines 2768–2808
export class GenerateLoremIpsum extends AbstractGenerator<{
sentencesCount?: number;
arraySize?: number;
}> {
static override readonly entityKind: string = 'GenerateLoremIpsum';
private state: {
rng: prand.RandomGenerator;
} | undefined;
override init({ count, seed }: { count: number; seed: number }) {
super.init({ count, seed });
const rng = prand.xoroshiro128plus(seed);
if (this.params.sentencesCount === undefined) this.params.sentencesCount = 1;
const maxLoremIpsumSentencesLength = maxLoremIpsumLength * this.params.sentencesCount + this.params.sentencesCount
- 1;
if (this.stringLength !== undefined && this.stringLength < maxLoremIpsumSentencesLength) {
throw new Error(
`You can't use lorem ipsum generator with a db column length restriction of ${this.stringLength}. Set the maximum string length to at least ${maxLoremIpsumSentencesLength}.`,
);
}
this.state = { rng };
}
generate() {
if (this.state === undefined) {
throw new Error('state is not defined.');
}
let idx, resultText: string = '';
for (let i = 0; i < this.params.sentencesCount!; i++) {
[idx, this.state.rng] = prand.uniformIntDistribution(0, loremIpsumSentences.length - 1, this.state.rng);
resultText += loremIpsumSentences[idx] + ' ';
}
return resultText;
}
}
Domain
Defined In
Source
Frequently Asked Questions
What is the GenerateLoremIpsum class?
GenerateLoremIpsum is a class in the drizzle-orm codebase, defined in drizzle-seed/src/services/Generators.ts.
Where is GenerateLoremIpsum defined?
GenerateLoremIpsum is defined in drizzle-seed/src/services/Generators.ts at line 2768.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free