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
  27bc7623_8c08_e5be_d4ed_26dc9d09158f["init()"]
  fb817b73_2ef2_452e_5f84_8bd519902eef["GenerateUniqueFirstName"]
  27bc7623_8c08_e5be_d4ed_26dc9d09158f -->|defined in| fb817b73_2ef2_452e_5f84_8bd519902eef
  style 27bc7623_8c08_e5be_d4ed_26dc9d09158f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-seed/src/services/Generators.ts lines 1609–1624

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

		if (this.stringLength !== undefined && this.stringLength < maxFirstNameLength) {
			throw new Error(
				`You can't use first name generator with a db column length restriction of ${this.stringLength}. Set the maximum string length to at least ${maxFirstNameLength}.`,
			);
		}

		const genIndicesObj = new GenerateUniqueInt({ minValue: 0, maxValue: firstNames.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 1609.

Analyze Your Own Codebase

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

Try Supermodel Free