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
  03d644e9_ebea_2852_6579_1cd3f30e24b7["customType()"]
  93e79285_19cd_4939_7e23_416703743740["custom.ts"]
  03d644e9_ebea_2852_6579_1cd3f30e24b7 -->|defined in| 93e79285_19cd_4939_7e23_416703743740
  style 03d644e9_ebea_2852_6579_1cd3f30e24b7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-orm/src/mysql-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,
		): MySqlCustomColumnBuilder<ConvertCustomConfig<'', T>>;
		<TName extends string>(
			dbName: TName,
			fieldConfig: T['config'],
		): MySqlCustomColumnBuilder<ConvertCustomConfig<TName, T>>;
	}
	: {
		(): MySqlCustomColumnBuilder<ConvertCustomConfig<'', T>>;
		<TConfig extends Record<string, any> & T['config']>(
			fieldConfig?: TConfig,
		): MySqlCustomColumnBuilder<ConvertCustomConfig<'', T>>;
		<TName extends string>(
			dbName: TName,
			fieldConfig?: T['config'],
		): MySqlCustomColumnBuilder<ConvertCustomConfig<TName, T>>;
	}
{
	return <TName extends string>(
		a?: TName | T['config'],
		b?: T['config'],
	): MySqlCustomColumnBuilder<ConvertCustomConfig<TName, T>> => {
		const { name, config } = getColumnNameAndConfig<T['config']>(a, b);
		return new MySqlCustomColumnBuilder(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/mysql-core/columns/custom.ts.
Where is customType() defined?
customType() is defined in drizzle-orm/src/mysql-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