Home / Class/ PrimaryKey Class — drizzle-orm Architecture

PrimaryKey Class — drizzle-orm Architecture

Architecture documentation for the PrimaryKey class in primary-keys.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  707ddcbe_fdb4_efd8_b55e_9ab1412280e2["PrimaryKey"]
  471611d2_cce2_4786_c10b_d1a110fdccc3["primary-keys.ts"]
  707ddcbe_fdb4_efd8_b55e_9ab1412280e2 -->|defined in| 471611d2_cce2_4786_c10b_d1a110fdccc3
  a4739384_417d_2d12_e429_a14ea65ab52e["constructor()"]
  707ddcbe_fdb4_efd8_b55e_9ab1412280e2 -->|method| a4739384_417d_2d12_e429_a14ea65ab52e
  56b5baa9_1360_34fb_4e74_688a84163224["getName()"]
  707ddcbe_fdb4_efd8_b55e_9ab1412280e2 -->|method| 56b5baa9_1360_34fb_4e74_688a84163224

Relationship Graph

Source Code

drizzle-orm/src/gel-core/primary-keys.ts lines 48–62

export class PrimaryKey {
	static readonly [entityKind]: string = 'GelPrimaryKey';

	readonly columns: AnyGelColumn<{}>[];
	readonly name?: string;

	constructor(readonly table: GelTable, columns: AnyGelColumn<{}>[], name?: string) {
		this.columns = columns;
		this.name = name;
	}

	getName(): string {
		return this.name ?? `${this.table[GelTable.Symbol.Name]}_${this.columns.map((column) => column.name).join('_')}_pk`;
	}
}

Domain

Frequently Asked Questions

What is the PrimaryKey class?
PrimaryKey is a class in the drizzle-orm codebase, defined in drizzle-orm/src/gel-core/primary-keys.ts.
Where is PrimaryKey defined?
PrimaryKey is defined in drizzle-orm/src/gel-core/primary-keys.ts at line 48.

Analyze Your Own Codebase

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

Try Supermodel Free