char.ts — drizzle-orm Source File
Architecture documentation for char.ts, a typescript file in the drizzle-orm codebase. 6 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR fabc2878_bfa9_c1ec_445c_2d0af8485090["char.ts"] 835b37b8_5537_93b3_6081_c47371e60b11["common.ts"] fabc2878_bfa9_c1ec_445c_2d0af8485090 --> 835b37b8_5537_93b3_6081_c47371e60b11 2dc784c6_95e9_4e28_ec81_7caf4acbd426["column-builder.ts"] fabc2878_bfa9_c1ec_445c_2d0af8485090 --> 2dc784c6_95e9_4e28_ec81_7caf4acbd426 05f0a280_d0c9_693a_a4bf_83cc671012d2["column.ts"] fabc2878_bfa9_c1ec_445c_2d0af8485090 --> 05f0a280_d0c9_693a_a4bf_83cc671012d2 27705a9d_afe9_57dd_8c97_e52d8a67d426["entity.ts"] fabc2878_bfa9_c1ec_445c_2d0af8485090 --> 27705a9d_afe9_57dd_8c97_e52d8a67d426 744f5864_8de4_6d1f_dcfc_5ef4ae408c9a["table.ts"] fabc2878_bfa9_c1ec_445c_2d0af8485090 --> 744f5864_8de4_6d1f_dcfc_5ef4ae408c9a ecce3253_1e75_a87f_27b3_ca87e81a3024["utils.ts"] fabc2878_bfa9_c1ec_445c_2d0af8485090 --> ecce3253_1e75_a87f_27b3_ca87e81a3024 a70c1ec7_29ee_10ca_2b05_4be0c246a540["all.ts"] a70c1ec7_29ee_10ca_2b05_4be0c246a540 --> fabc2878_bfa9_c1ec_445c_2d0af8485090 style fabc2878_bfa9_c1ec_445c_2d0af8485090 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 { AnySingleStoreTable } from '~/singlestore-core/table.ts';
import { getColumnNameAndConfig, type Writable } from '~/utils.ts';
import { SingleStoreColumn, SingleStoreColumnBuilder } from './common.ts';
export type SingleStoreCharBuilderInitial<
TName extends string,
TEnum extends [string, ...string[]],
TLength extends number | undefined,
> = SingleStoreCharBuilder<{
name: TName;
dataType: 'string';
columnType: 'SingleStoreChar';
data: TEnum[number];
driverParam: number | string;
enumValues: TEnum;
generated: undefined;
length: TLength;
}>;
export class SingleStoreCharBuilder<
T extends ColumnBuilderBaseConfig<'string', 'SingleStoreChar'> & { length?: number | undefined },
> extends SingleStoreColumnBuilder<
T,
SingleStoreCharConfig<T['enumValues'], T['length']>,
{ length: T['length'] }
> {
static override readonly [entityKind]: string = 'SingleStoreCharBuilder';
constructor(name: T['name'], config: SingleStoreCharConfig<T['enumValues'], T['length']>) {
super(name, 'string', 'SingleStoreChar');
this.config.length = config.length;
this.config.enum = config.enum;
}
/** @internal */
override build<TTableName extends string>(
table: AnySingleStoreTable<{ name: TTableName }>,
): SingleStoreChar<MakeColumnConfig<T, TTableName> & { length: T['length']; enumValues: T['enumValues'] }> {
return new SingleStoreChar<MakeColumnConfig<T, TTableName> & { length: T['length']; enumValues: T['enumValues'] }>(
table,
this.config as ColumnBuilderRuntimeConfig<any, any>,
);
}
}
export class SingleStoreChar<T extends ColumnBaseConfig<'string', 'SingleStoreChar'> & { length?: number | undefined }>
extends SingleStoreColumn<T, SingleStoreCharConfig<T['enumValues'], T['length']>, { length: T['length'] }>
{
static override readonly [entityKind]: string = 'SingleStoreChar';
readonly length: T['length'] = this.config.length;
override readonly enumValues = this.config.enum;
getSQLType(): string {
return this.length === undefined ? `char` : `char(${this.length})`;
}
}
export interface SingleStoreCharConfig<
TEnum extends readonly string[] | string[] | undefined = readonly string[] | string[] | undefined,
TLength extends number | undefined = number | undefined,
> {
enum?: TEnum;
length?: TLength;
}
export function char(): SingleStoreCharBuilderInitial<'', [string, ...string[]], undefined>;
export function char<U extends string, T extends Readonly<[U, ...U[]]>, L extends number | undefined>(
config?: SingleStoreCharConfig<T | Writable<T>, L>,
): SingleStoreCharBuilderInitial<'', Writable<T>, L>;
export function char<
TName extends string,
U extends string,
T extends Readonly<[U, ...U[]]>,
L extends number | undefined,
>(
name: TName,
config?: SingleStoreCharConfig<T | Writable<T>, L>,
): SingleStoreCharBuilderInitial<TName, Writable<T>, L>;
export function char(a?: string | SingleStoreCharConfig, b: SingleStoreCharConfig = {}): any {
const { name, config } = getColumnNameAndConfig<SingleStoreCharConfig>(a, b);
return new SingleStoreCharBuilder(name, config as any);
}
Domain
Subdomains
Functions
Dependencies
- column-builder.ts
- column.ts
- common.ts
- entity.ts
- table.ts
- utils.ts
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, RelationalQuery subdomain.
What functions are defined in char.ts?
char.ts defines 1 function(s): char.
What does char.ts depend on?
char.ts imports 6 module(s): 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/singlestore-core/columns/char.ts (domain: DrizzleORM, subdomain: RelationalQuery, directory: drizzle-orm/src/singlestore-core/columns).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free