primary-keys.ts — drizzle-orm Source File
Architecture documentation for primary-keys.ts, a typescript file in the drizzle-orm codebase. 4 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR 23f0730e_a6b8_4342_cdc4_6f458b4467d7["primary-keys.ts"] c2ee5a75_b49e_5e5a_3712_97b1b67b4a7b["index.ts"] 23f0730e_a6b8_4342_cdc4_6f458b4467d7 --> c2ee5a75_b49e_5e5a_3712_97b1b67b4a7b 3c5f95cc_22b6_3d0d_d9be_3e274450e9e7["table.ts"] 23f0730e_a6b8_4342_cdc4_6f458b4467d7 --> 3c5f95cc_22b6_3d0d_d9be_3e274450e9e7 2f757dbf_c4e6_7cc5_451a_b72c48bbed4c["SingleStoreTable"] 23f0730e_a6b8_4342_cdc4_6f458b4467d7 --> 2f757dbf_c4e6_7cc5_451a_b72c48bbed4c 27705a9d_afe9_57dd_8c97_e52d8a67d426["entity.ts"] 23f0730e_a6b8_4342_cdc4_6f458b4467d7 --> 27705a9d_afe9_57dd_8c97_e52d8a67d426 3c5f95cc_22b6_3d0d_d9be_3e274450e9e7["table.ts"] 3c5f95cc_22b6_3d0d_d9be_3e274450e9e7 --> 23f0730e_a6b8_4342_cdc4_6f458b4467d7 ae5f6568_e61c_e2e0_88cb_92eabc9ba98e["utils.ts"] ae5f6568_e61c_e2e0_88cb_92eabc9ba98e --> 23f0730e_a6b8_4342_cdc4_6f458b4467d7 style 23f0730e_a6b8_4342_cdc4_6f458b4467d7 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { entityKind } from '~/entity.ts';
import type { AnySingleStoreColumn, SingleStoreColumn } from './columns/index.ts';
import { SingleStoreTable } from './table.ts';
export function primaryKey<
TTableName extends string,
TColumn extends AnySingleStoreColumn<{ tableName: TTableName }>,
TColumns extends AnySingleStoreColumn<{ tableName: TTableName }>[],
>(config: { name?: string; columns: [TColumn, ...TColumns] }): PrimaryKeyBuilder;
/**
* @deprecated: Please use primaryKey({ columns: [] }) instead of this function
* @param columns
*/
export function primaryKey<
TTableName extends string,
TColumns extends AnySingleStoreColumn<{ tableName: TTableName }>[],
>(...columns: TColumns): PrimaryKeyBuilder;
export function primaryKey(...config: any) {
if (config[0].columns) {
return new PrimaryKeyBuilder(config[0].columns, config[0].name);
}
return new PrimaryKeyBuilder(config);
}
export class PrimaryKeyBuilder {
static readonly [entityKind]: string = 'SingleStorePrimaryKeyBuilder';
/** @internal */
columns: SingleStoreColumn[];
/** @internal */
name?: string;
constructor(
columns: SingleStoreColumn[],
name?: string,
) {
this.columns = columns;
this.name = name;
}
/** @internal */
build(table: SingleStoreTable): PrimaryKey {
return new PrimaryKey(table, this.columns, this.name);
}
}
export class PrimaryKey {
static readonly [entityKind]: string = 'SingleStorePrimaryKey';
readonly columns: SingleStoreColumn[];
readonly name?: string;
constructor(readonly table: SingleStoreTable, columns: SingleStoreColumn[], name?: string) {
this.columns = columns;
this.name = name;
}
getName(): string {
return this.name
?? `${this.table[SingleStoreTable.Symbol.Name]}_${this.columns.map((column) => column.name).join('_')}_pk`;
}
}
Domain
Subdomains
Functions
Classes
Dependencies
- SingleStoreTable
- entity.ts
- index.ts
- table.ts
Source
Frequently Asked Questions
What does primary-keys.ts do?
primary-keys.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain, RelationalQuery subdomain.
What functions are defined in primary-keys.ts?
primary-keys.ts defines 1 function(s): primaryKey.
What does primary-keys.ts depend on?
primary-keys.ts imports 4 module(s): SingleStoreTable, entity.ts, index.ts, table.ts.
What files import primary-keys.ts?
primary-keys.ts is imported by 2 file(s): table.ts, utils.ts.
Where is primary-keys.ts in the architecture?
primary-keys.ts is located at drizzle-orm/src/singlestore-core/primary-keys.ts (domain: DrizzleORM, subdomain: RelationalQuery, directory: drizzle-orm/src/singlestore-core).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free