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

init() — drizzle-orm Function Reference

Architecture documentation for the init() function in Generators.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  76fe6834_51e3_191e_425c_3752a85f6c1a["init()"]
  a193cef1_a62a_eb6c_09a3_6df6ce2a2706["GenerateUniqueCountry"]
  76fe6834_51e3_191e_425c_3752a85f6c1a -->|defined in| a193cef1_a62a_eb6c_09a3_6df6ce2a2706
  style 76fe6834_51e3_191e_425c_3752a85f6c1a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-seed/src/services/Generators.ts lines 2130–2145

	override init({ count, seed }: { count: number; seed: number }) {
		if (count > countries.length) {
			throw new Error('count exceeds max number of unique countries.');
		}

		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}.`,
			);
		}

		const genIndicesObj = new GenerateUniqueInt({ minValue: 0, maxValue: countries.length - 1 });
		genIndicesObj.init({ count, seed });

		this.state = { genIndicesObj };
	}

Domain

Subdomains

Frequently Asked Questions

What does init() do?
init() is a function in the drizzle-orm codebase, defined in drizzle-seed/src/services/Generators.ts.
Where is init() defined?
init() is defined in drizzle-seed/src/services/Generators.ts at line 2130.

Analyze Your Own Codebase

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

Try Supermodel Free