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

generate() — drizzle-orm Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  6255ba91_a5fe_8a61_402b_8f02c5ba196d["generate()"]
  f8854caa_b123_bbb1_c599_c55f6c26fcba["GenerateLine"]
  6255ba91_a5fe_8a61_402b_8f02c5ba196d -->|defined in| f8854caa_b123_bbb1_c599_c55f6c26fcba
  style 6255ba91_a5fe_8a61_402b_8f02c5ba196d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-seed/src/services/Generators.ts lines 3026–3049

	generate() {
		if (this.state === undefined) {
			throw new Error('state is not defined.');
		}

		let b: number;
		const a = this.state.aCoefficientGen.generate();

		b = this.state.bCoefficientGen.generate();
		while (a === 0 && b === 0) {
			b = this.state.bCoefficientGen.generate();
		}

		const c = this.state.cCoefficientGen.generate();

		if (this.dataType === 'json') {
			return { a, b, c };
		} else if (this.dataType === 'string') {
			return `[${a}, ${b}, ${c}]`;
		} else {
			// if (this.dataType === "array")
			return [a, b, c];
		}
	}

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free