Home / Function/ customType() — drizzle-orm Function Reference

customType() — drizzle-orm Function Reference

Architecture documentation for the customType() function in custom.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  beff6731_e975_1b2f_16f0_da536b333323["customType()"]
  c6aa158d_d194_bbd9_1adc_38701adb30de["custom.ts"]
  beff6731_e975_1b2f_16f0_da536b333323 -->|defined in| c6aa158d_d194_bbd9_1adc_38701adb30de
  style beff6731_e975_1b2f_16f0_da536b333323 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-orm/src/gel-core/columns/custom.ts lines 203–232

export function customType<T extends CustomTypeValues = CustomTypeValues>(
	customTypeParams: CustomTypeParams<T>,
): Equal<T['configRequired'], true> extends true ? {
		<TConfig extends Record<string, any> & T['config']>(
			fieldConfig: TConfig,
		): GelCustomColumnBuilder<ConvertCustomConfig<'', T>>;
		<TName extends string>(
			dbName: TName,
			fieldConfig: T['config'],
		): GelCustomColumnBuilder<ConvertCustomConfig<TName, T>>;
	}
	: {
		(): GelCustomColumnBuilder<ConvertCustomConfig<'', T>>;
		<TConfig extends Record<string, any> & T['config']>(
			fieldConfig?: TConfig,
		): GelCustomColumnBuilder<ConvertCustomConfig<'', T>>;
		<TName extends string>(
			dbName: TName,
			fieldConfig?: T['config'],
		): GelCustomColumnBuilder<ConvertCustomConfig<TName, T>>;
	}
{
	return <TName extends string>(
		a?: TName | T['config'],
		b?: T['config'],
	): GelCustomColumnBuilder<ConvertCustomConfig<TName, T>> => {
		const { name, config } = getColumnNameAndConfig<T['config']>(a, b);
		return new GelCustomColumnBuilder(name as ConvertCustomConfig<TName, T>['name'], config, customTypeParams);
	};
}

Domain

Subdomains

Frequently Asked Questions

What does customType() do?
customType() is a function in the drizzle-orm codebase, defined in drizzle-orm/src/gel-core/columns/custom.ts.
Where is customType() defined?
customType() is defined in drizzle-orm/src/gel-core/columns/custom.ts at line 203.

Analyze Your Own Codebase

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

Try Supermodel Free