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
  2d67a132_c385_7a96_63da_9db9b2f4b42d["customType()"]
  8acf7f1c_a3fb_3dd8_17fe_b6f3f78e2a74["custom.ts"]
  2d67a132_c385_7a96_63da_9db9b2f4b42d -->|defined in| 8acf7f1c_a3fb_3dd8_17fe_b6f3f78e2a74
  style 2d67a132_c385_7a96_63da_9db9b2f4b42d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-orm/src/singlestore-core/columns/custom.ts lines 206–235

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

Analyze Your Own Codebase

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

Try Supermodel Free