char.ts — drizzle-orm Source File
Architecture documentation for char.ts, a typescript file in the drizzle-orm codebase. 7 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR eb53d002_51a7_6f92_43e3_0451f4322791["char.ts"] f4f42b4c_8610_03dd_fe01_232098668127["common.ts"] eb53d002_51a7_6f92_43e3_0451f4322791 --> f4f42b4c_8610_03dd_fe01_232098668127 099d7c6d_2fc4_7b20_40e3_1b8af4138fe6["PgColumn"] eb53d002_51a7_6f92_43e3_0451f4322791 --> 099d7c6d_2fc4_7b20_40e3_1b8af4138fe6 2dc784c6_95e9_4e28_ec81_7caf4acbd426["column-builder.ts"] eb53d002_51a7_6f92_43e3_0451f4322791 --> 2dc784c6_95e9_4e28_ec81_7caf4acbd426 05f0a280_d0c9_693a_a4bf_83cc671012d2["column.ts"] eb53d002_51a7_6f92_43e3_0451f4322791 --> 05f0a280_d0c9_693a_a4bf_83cc671012d2 27705a9d_afe9_57dd_8c97_e52d8a67d426["entity.ts"] eb53d002_51a7_6f92_43e3_0451f4322791 --> 27705a9d_afe9_57dd_8c97_e52d8a67d426 17418917_ff81_c4e5_90f4_f37d557e5d51["table.ts"] eb53d002_51a7_6f92_43e3_0451f4322791 --> 17418917_ff81_c4e5_90f4_f37d557e5d51 ecce3253_1e75_a87f_27b3_ca87e81a3024["utils.ts"] eb53d002_51a7_6f92_43e3_0451f4322791 --> ecce3253_1e75_a87f_27b3_ca87e81a3024 b38cf654_48d6_41dc_6c0f_203697984d98["all.ts"] b38cf654_48d6_41dc_6c0f_203697984d98 --> eb53d002_51a7_6f92_43e3_0451f4322791 style eb53d002_51a7_6f92_43e3_0451f4322791 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';
import type { ColumnBaseConfig } from '~/column.ts';
import { entityKind } from '~/entity.ts';
import type { AnyPgTable } from '~/pg-core/table.ts';
import { getColumnNameAndConfig, type Writable } from '~/utils.ts';
import { PgColumn, PgColumnBuilder } from './common.ts';
export type PgCharBuilderInitial<
TName extends string,
TEnum extends [string, ...string[]],
TLength extends number | undefined,
> = PgCharBuilder<{
name: TName;
dataType: 'string';
columnType: 'PgChar';
data: TEnum[number];
enumValues: TEnum;
driverParam: string;
length: TLength;
}>;
export class PgCharBuilder<T extends ColumnBuilderBaseConfig<'string', 'PgChar'> & { length?: number | undefined }>
extends PgColumnBuilder<
T,
{ length: T['length']; enumValues: T['enumValues'] },
{ length: T['length'] }
>
{
static override readonly [entityKind]: string = 'PgCharBuilder';
constructor(name: T['name'], config: PgCharConfig<T['enumValues'], T['length']>) {
super(name, 'string', 'PgChar');
this.config.length = config.length;
this.config.enumValues = config.enum;
}
/** @internal */
override build<TTableName extends string>(
table: AnyPgTable<{ name: TTableName }>,
): PgChar<MakeColumnConfig<T, TTableName> & { length: T['length'] }> {
return new PgChar<MakeColumnConfig<T, TTableName> & { length: T['length'] }>(
table,
this.config as ColumnBuilderRuntimeConfig<any, any>,
);
}
}
export class PgChar<T extends ColumnBaseConfig<'string', 'PgChar'> & { length?: number | undefined }>
extends PgColumn<T, { length: T['length']; enumValues: T['enumValues'] }, { length: T['length'] }>
{
static override readonly [entityKind]: string = 'PgChar';
readonly length = this.config.length;
override readonly enumValues = this.config.enumValues;
getSQLType(): string {
return this.length === undefined ? `char` : `char(${this.length})`;
}
}
export interface PgCharConfig<
TEnum extends readonly string[] | string[] | undefined = readonly string[] | string[] | undefined,
TLength extends number | undefined = number | undefined,
> {
enum?: TEnum;
length?: TLength;
}
export function char(): PgCharBuilderInitial<'', [string, ...string[]], undefined>;
export function char<U extends string, T extends Readonly<[U, ...U[]]>, L extends number | undefined>(
config?: PgCharConfig<T | Writable<T>, L>,
): PgCharBuilderInitial<'', Writable<T>, L>;
export function char<
TName extends string,
U extends string,
T extends Readonly<[U, ...U[]]>,
L extends number | undefined,
>(
name: TName,
config?: PgCharConfig<T | Writable<T>, L>,
): PgCharBuilderInitial<TName, Writable<T>, L>;
export function char(a?: string | PgCharConfig, b: PgCharConfig = {}): any {
const { name, config } = getColumnNameAndConfig<PgCharConfig>(a, b);
return new PgCharBuilder(name, config as any);
}
Domain
Subdomains
Functions
Classes
Imported By
Source
Frequently Asked Questions
What does char.ts do?
char.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain, DatabaseDrivers subdomain.
What functions are defined in char.ts?
char.ts defines 1 function(s): char.
What does char.ts depend on?
char.ts imports 7 module(s): PgColumn, column-builder.ts, column.ts, common.ts, entity.ts, table.ts, utils.ts.
What files import char.ts?
char.ts is imported by 1 file(s): all.ts.
Where is char.ts in the architecture?
char.ts is located at drizzle-orm/src/pg-core/columns/char.ts (domain: DrizzleORM, subdomain: DatabaseDrivers, directory: drizzle-orm/src/pg-core/columns).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free