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 RelationalQuery 8 imports 1 dependents 3 functions 2 classes

Entity Profile

Dependency Diagram

graph LR
  c6aa158d_d194_bbd9_1adc_38701adb30de["custom.ts"]
  a74dd48d_d5e3_6bb4_19c7_1954c9126816["common.ts"]
  c6aa158d_d194_bbd9_1adc_38701adb30de --> a74dd48d_d5e3_6bb4_19c7_1954c9126816
  d67beed0_fcf6_77d7_10cf_cdcfd53f8551["GelColumn"]
  c6aa158d_d194_bbd9_1adc_38701adb30de --> d67beed0_fcf6_77d7_10cf_cdcfd53f8551
  2dc784c6_95e9_4e28_ec81_7caf4acbd426["column-builder.ts"]
  c6aa158d_d194_bbd9_1adc_38701adb30de --> 2dc784c6_95e9_4e28_ec81_7caf4acbd426
  05f0a280_d0c9_693a_a4bf_83cc671012d2["column.ts"]
  c6aa158d_d194_bbd9_1adc_38701adb30de --> 05f0a280_d0c9_693a_a4bf_83cc671012d2
  27705a9d_afe9_57dd_8c97_e52d8a67d426["entity.ts"]
  c6aa158d_d194_bbd9_1adc_38701adb30de --> 27705a9d_afe9_57dd_8c97_e52d8a67d426
  c1a47e5e_63aa_1ab2_abac_86e509f63e7c["table.ts"]
  c6aa158d_d194_bbd9_1adc_38701adb30de --> c1a47e5e_63aa_1ab2_abac_86e509f63e7c
  be483a7f_d5d7_7a9b_9a13_44a4a6aafbbd["sql.ts"]
  c6aa158d_d194_bbd9_1adc_38701adb30de --> be483a7f_d5d7_7a9b_9a13_44a4a6aafbbd
  ecce3253_1e75_a87f_27b3_ca87e81a3024["utils.ts"]
  c6aa158d_d194_bbd9_1adc_38701adb30de --> ecce3253_1e75_a87f_27b3_ca87e81a3024
  ee61f0b9_206c_6b7b_5671_49b96bcf3a63["all.ts"]
  ee61f0b9_206c_6b7b_5671_49b96bcf3a63 --> c6aa158d_d194_bbd9_1adc_38701adb30de
  style c6aa158d_d194_bbd9_1adc_38701adb30de 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 { AnyGelTable } from '~/gel-core/table.ts';
import type { SQL } from '~/sql/sql.ts';
import { type Equal, getColumnNameAndConfig } from '~/utils.ts';
import { GelColumn, GelColumnBuilder } from './common.ts';

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

export interface GelCustomColumnInnerConfig {
	customTypeValues: CustomTypeValues;
}

export class GelCustomColumnBuilder<T extends ColumnBuilderBaseConfig<'custom', 'GelCustomColumn'>>
	extends GelColumnBuilder<
		T,
		{
			fieldConfig: CustomTypeValues['config'];
			customTypeParams: CustomTypeParams<any>;
		},
		{
			gelColumnBuilderBrand: 'GelCustomColumnBuilderBrand';
		}
	>
{
	static override readonly [entityKind]: string = 'GelCustomColumnBuilder';

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

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

export class GelCustomColumn<T extends ColumnBaseConfig<'custom', 'GelCustomColumn'>> extends GelColumn<T> {
// ... (173 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, RelationalQuery 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): GelColumn, 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/gel-core/columns/custom.ts (domain: DrizzleORM, subdomain: RelationalQuery, directory: drizzle-orm/src/gel-core/columns).

Analyze Your Own Codebase

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

Try Supermodel Free