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

Relationship Graph

Source Code

drizzle-seed/src/services/Generators.ts lines 589–610

	override init({ count, seed }: { count: number; seed: number }) {
		super.init({ count, seed });

		let { minValue, maxValue } = this.params;

		if (maxValue === undefined) {
			maxValue = 1000;
		}

		if (minValue === undefined) {
			minValue = -maxValue;
		}

		if (typeof minValue === 'number' && typeof maxValue === 'number') {
			minValue = minValue >= 0 ? Math.ceil(minValue) : Math.floor(minValue);
			maxValue = maxValue >= 0 ? Math.floor(maxValue) : Math.ceil(maxValue);
		}

		const rng = prand.xoroshiro128plus(seed);

		this.state = { rng, minValue, maxValue };
	}

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

Analyze Your Own Codebase

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

Try Supermodel Free