Home / File/ custom.ts — drizzle-orm Source File

custom.ts — drizzle-orm Source File

Architecture documentation for custom.ts, a typescript file in the drizzle-orm codebase. 8 imports, 1 dependents.

File typescript DrizzleORM SQLDialects 8 imports 1 dependents 3 functions 2 classes

Entity Profile

Dependency Diagram

graph LR
  e7326635_a1d9_22bf_400e_da3a7dd63899["custom.ts"]
  a4c1e5cb_a206_4786_985b_0e0a35ddd536["common.ts"]
  e7326635_a1d9_22bf_400e_da3a7dd63899 --> a4c1e5cb_a206_4786_985b_0e0a35ddd536
  f78ef1e1_d140_1e8a_3de5_d93a866c939f["SQLiteColumn"]
  e7326635_a1d9_22bf_400e_da3a7dd63899 --> f78ef1e1_d140_1e8a_3de5_d93a866c939f
  2dc784c6_95e9_4e28_ec81_7caf4acbd426["column-builder.ts"]
  e7326635_a1d9_22bf_400e_da3a7dd63899 --> 2dc784c6_95e9_4e28_ec81_7caf4acbd426
  05f0a280_d0c9_693a_a4bf_83cc671012d2["column.ts"]
  e7326635_a1d9_22bf_400e_da3a7dd63899 --> 05f0a280_d0c9_693a_a4bf_83cc671012d2
  27705a9d_afe9_57dd_8c97_e52d8a67d426["entity.ts"]
  e7326635_a1d9_22bf_400e_da3a7dd63899 --> 27705a9d_afe9_57dd_8c97_e52d8a67d426
  be483a7f_d5d7_7a9b_9a13_44a4a6aafbbd["sql.ts"]
  e7326635_a1d9_22bf_400e_da3a7dd63899 --> be483a7f_d5d7_7a9b_9a13_44a4a6aafbbd
  227c0a5e_dd35_a654_1766_5a30cb1b922f["table.ts"]
  e7326635_a1d9_22bf_400e_da3a7dd63899 --> 227c0a5e_dd35_a654_1766_5a30cb1b922f
  ecce3253_1e75_a87f_27b3_ca87e81a3024["utils.ts"]
  e7326635_a1d9_22bf_400e_da3a7dd63899 --> ecce3253_1e75_a87f_27b3_ca87e81a3024
  0bca2cbd_0e97_da69_ba34_0de360b77802["all.ts"]
  0bca2cbd_0e97_da69_ba34_0de360b77802 --> e7326635_a1d9_22bf_400e_da3a7dd63899
  style e7326635_a1d9_22bf_400e_da3a7dd63899 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 { SQL } from '~/sql/sql.ts';
import type { AnySQLiteTable } from '~/sqlite-core/table.ts';
import { type Equal, getColumnNameAndConfig } from '~/utils.ts';
import { SQLiteColumn, SQLiteColumnBuilder } from './common.ts';

export type ConvertCustomConfig<TName extends string, T extends Partial<CustomTypeValues>> =
	& {
		name: TName;
		dataType: 'custom';
		columnType: 'SQLiteCustomColumn';
		data: T['data'];
		driverParam: T['driverData'];
		enumValues: undefined;
	}
	& (T['notNull'] extends true ? { notNull: true } : {})
	& (T['default'] extends true ? { hasDefault: true } : {});

export interface SQLiteCustomColumnInnerConfig {
	customTypeValues: CustomTypeValues;
}

export class SQLiteCustomColumnBuilder<T extends ColumnBuilderBaseConfig<'custom', 'SQLiteCustomColumn'>>
	extends SQLiteColumnBuilder<
		T,
		{
			fieldConfig: CustomTypeValues['config'];
			customTypeParams: CustomTypeParams<any>;
		},
		{
			sqliteColumnBuilderBrand: 'SQLiteCustomColumnBuilderBrand';
		}
	>
{
	static override readonly [entityKind]: string = 'SQLiteCustomColumnBuilder';

	constructor(
		name: T['name'],
		fieldConfig: CustomTypeValues['config'],
		customTypeParams: CustomTypeParams<any>,
	) {
		super(name, 'custom', 'SQLiteCustomColumn');
		this.config.fieldConfig = fieldConfig;
		this.config.customTypeParams = customTypeParams;
	}

	/** @internal */
	build<TTableName extends string>(
		table: AnySQLiteTable<{ name: TTableName }>,
	): SQLiteCustomColumn<MakeColumnConfig<T, TTableName>> {
		return new SQLiteCustomColumn<MakeColumnConfig<T, TTableName>>(
			table,
			this.config as ColumnBuilderRuntimeConfig<any, any>,
		);
	}
}

export class SQLiteCustomColumn<T extends ColumnBaseConfig<'custom', 'SQLiteCustomColumn'>> extends SQLiteColumn<T> {
// ... (177 more lines)

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does custom.ts do?
custom.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain, SQLDialects subdomain.
What functions are defined in custom.ts?
custom.ts defines 3 function(s): config, customType, value.
What does custom.ts depend on?
custom.ts imports 8 module(s): SQLiteColumn, column-builder.ts, column.ts, common.ts, entity.ts, sql.ts, table.ts, utils.ts.
What files import custom.ts?
custom.ts is imported by 1 file(s): all.ts.
Where is custom.ts in the architecture?
custom.ts is located at drizzle-orm/src/sqlite-core/columns/custom.ts (domain: DrizzleORM, subdomain: SQLDialects, directory: drizzle-orm/src/sqlite-core/columns).

Analyze Your Own Codebase

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

Try Supermodel Free