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

init() — drizzle-orm Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  f6745cad_d323_9e92_2e27_ddd99bbf4404["init()"]
  edccb078_72bf_7593_a17b_79784ccdfa56["GenerateUniqueStringV2"]
  f6745cad_d323_9e92_2e27_ddd99bbf4404 -->|defined in| edccb078_72bf_7593_a17b_79784ccdfa56
  style f6745cad_d323_9e92_2e27_ddd99bbf4404 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-seed/src/services/versioning/v2.ts lines 182–200

	override init({ seed, count }: { seed: number; count: number }) {
		const rng = prand.xoroshiro128plus(seed);

		let minStringLength = 7;
		let maxStringLength = 20;
		// TODO: revise later
		if (this.stringLength !== undefined) {
			maxStringLength = this.stringLength;
			if (maxStringLength === 1 || maxStringLength < minStringLength) minStringLength = maxStringLength;
		}

		if (maxStringLength < count.toString(16).length) {
			throw new Error(
				`You can't generate ${count} unique strings, with a maximum string length of ${maxStringLength}.`,
			);
		}

		this.state = { rng, minStringLength, maxStringLength };
	}

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free