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

generateIdentityParams() — drizzle-orm Function Reference

Architecture documentation for the generateIdentityParams() function in introspect-pg.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  8642c18c_17cd_9f6a_3538_48fe742e050e["generateIdentityParams()"]
  71516551_23e3_bf30_27c9_000fb046ef71["introspect-pg.ts"]
  8642c18c_17cd_9f6a_3538_48fe742e050e -->|defined in| 71516551_23e3_bf30_27c9_000fb046ef71
  d060c9b2_d1df_37e7_df71_422307a42ed6["createTableColumns()"]
  d060c9b2_d1df_37e7_df71_422307a42ed6 -->|calls| 8642c18c_17cd_9f6a_3538_48fe742e050e
  style 8642c18c_17cd_9f6a_3538_48fe742e050e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-kit/src/introspect-pg.ts lines 277–302

function generateIdentityParams(identity: Column['identity']) {
	let paramsObj = `{ name: "${identity!.name}"`;
	if (identity?.startWith) {
		paramsObj += `, startWith: ${identity.startWith}`;
	}
	if (identity?.increment) {
		paramsObj += `, increment: ${identity.increment}`;
	}
	if (identity?.minValue) {
		paramsObj += `, minValue: ${identity.minValue}`;
	}
	if (identity?.maxValue) {
		paramsObj += `, maxValue: ${identity.maxValue}`;
	}
	if (identity?.cache) {
		paramsObj += `, cache: ${identity.cache}`;
	}
	if (identity?.cycle) {
		paramsObj += `, cycle: true`;
	}
	paramsObj += ' }';
	if (identity?.type === 'always') {
		return `.generatedAlwaysAsIdentity(${paramsObj})`;
	}
	return `.generatedByDefaultAsIdentity(${paramsObj})`;
}

Domain

Subdomains

Frequently Asked Questions

What does generateIdentityParams() do?
generateIdentityParams() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/introspect-pg.ts.
Where is generateIdentityParams() defined?
generateIdentityParams() is defined in drizzle-kit/src/introspect-pg.ts at line 277.
What calls generateIdentityParams()?
generateIdentityParams() is called by 1 function(s): createTableColumns.

Analyze Your Own Codebase

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

Try Supermodel Free