Home / Function/ generate() — drizzle-orm Function Reference

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
  96e7c9f7_6cec_ab45_57a2_641ce488460e["generate()"]
  91af7e58_7645_9a50_e553_0b1bb5526ad0["GenerateStreetAddress"]
  96e7c9f7_6cec_ab45_57a2_641ce488460e -->|defined in| 91af7e58_7645_9a50_e553_0b1bb5526ad0
  style 96e7c9f7_6cec_ab45_57a2_641ce488460e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-seed/src/services/Generators.ts lines 2222–2241

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

		let idx, streetBaseNameIdx, streetSuffixIdx, streetNumber;
		[idx, this.state.rng] = prand.uniformIntDistribution(0, this.state.possStreetNames.length - 1, this.state.rng);

		[streetBaseNameIdx, this.state.rng] = prand.uniformIntDistribution(
			0,
			this.state.possStreetNames[idx]!.length - 1,
			this.state.rng,
		);
		[streetSuffixIdx, this.state.rng] = prand.uniformIntDistribution(0, streetSuffix.length - 1, this.state.rng);
		const streetName = `${this.state.possStreetNames[idx]![streetBaseNameIdx]} ${streetSuffix[streetSuffixIdx]}`;

		[streetNumber, this.state.rng] = prand.uniformIntDistribution(1, 999, this.state.rng);

		return `${streetNumber} ${streetName}`;
	}

Domain

Subdomains

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 2222.

Analyze Your Own Codebase

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

Try Supermodel Free