Home / Class/ GenerateJobTitle Class — drizzle-orm Architecture

GenerateJobTitle Class — drizzle-orm Architecture

Architecture documentation for the GenerateJobTitle class in Generators.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  09eb9962_dbdf_6db4_98a2_43c9ef5339ae["GenerateJobTitle"]
  e5cee001_0354_7e76_ef0a_06dca71dc8ce["Generators.ts"]
  09eb9962_dbdf_6db4_98a2_43c9ef5339ae -->|defined in| e5cee001_0354_7e76_ef0a_06dca71dc8ce
  867833c9_e943_df0a_aca2_89189ab173fa["init()"]
  09eb9962_dbdf_6db4_98a2_43c9ef5339ae -->|method| 867833c9_e943_df0a_aca2_89189ab173fa
  280b754c_96af_a512_a8b9_65ba00a7538a["generate()"]
  09eb9962_dbdf_6db4_98a2_43c9ef5339ae -->|method| 280b754c_96af_a512_a8b9_65ba00a7538a

Relationship Graph

Source Code

drizzle-seed/src/services/Generators.ts lines 2159–2192

export class GenerateJobTitle extends AbstractGenerator<{
	arraySize?: number;
}> {
	static override readonly entityKind: string = 'GenerateJobTitle';

	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.stringLength !== undefined && this.stringLength < maxJobTitleLength) {
			throw new Error(
				`You can't use job title generator with a db column length restriction of ${this.stringLength}. Set the maximum string length to at least ${maxJobTitleLength}.`,
			);
		}

		this.state = { rng };
	}

	generate() {
		if (this.state === undefined) {
			throw new Error('state is not defined.');
		}
		let idx;

		[idx, this.state.rng] = prand.uniformIntDistribution(0, jobsTitles.length - 1, this.state.rng);

		return jobsTitles[idx];
	}
}

Domain

Frequently Asked Questions

What is the GenerateJobTitle class?
GenerateJobTitle is a class in the drizzle-orm codebase, defined in drizzle-seed/src/services/Generators.ts.
Where is GenerateJobTitle defined?
GenerateJobTitle is defined in drizzle-seed/src/services/Generators.ts at line 2159.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free