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
  ac6ab817_d245_8b0e_b426_a2af3e3478c6["init()"]
  78c441aa_f70b_cd58_66f5_65ef7c43aa07["GenerateUniqueLastName"]
  ac6ab817_d245_8b0e_b426_a2af3e3478c6 -->|defined in| 78c441aa_f70b_cd58_66f5_65ef7c43aa07
  style ac6ab817_d245_8b0e_b426_a2af3e3478c6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-seed/src/services/Generators.ts lines 1683–1698

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

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

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

Analyze Your Own Codebase

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

Try Supermodel Free