Home / Class/ GelCustomColumn Class — drizzle-orm Architecture

GelCustomColumn Class — drizzle-orm Architecture

Architecture documentation for the GelCustomColumn class in custom.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  616e39c3_067e_587c_3b70_077e328f99e3["GelCustomColumn"]
  c6aa158d_d194_bbd9_1adc_38701adb30de["custom.ts"]
  616e39c3_067e_587c_3b70_077e328f99e3 -->|defined in| c6aa158d_d194_bbd9_1adc_38701adb30de
  3e35601a_b70f_f1ed_8681_272abcb6220c["constructor()"]
  616e39c3_067e_587c_3b70_077e328f99e3 -->|method| 3e35601a_b70f_f1ed_8681_272abcb6220c
  4bfcd189_355c_0d74_3d97_09de8b730559["getSQLType()"]
  616e39c3_067e_587c_3b70_077e328f99e3 -->|method| 4bfcd189_355c_0d74_3d97_09de8b730559
  1e5327f0_e95c_0fae_1841_fc3a579242ea["mapFromDriverValue()"]
  616e39c3_067e_587c_3b70_077e328f99e3 -->|method| 1e5327f0_e95c_0fae_1841_fc3a579242ea
  af4b91b9_0674_3688_617f_3ae36818557b["mapToDriverValue()"]
  616e39c3_067e_587c_3b70_077e328f99e3 -->|method| af4b91b9_0674_3688_617f_3ae36818557b

Relationship Graph

Source Code

drizzle-orm/src/gel-core/columns/custom.ts lines 60–88

export class GelCustomColumn<T extends ColumnBaseConfig<'custom', 'GelCustomColumn'>> extends GelColumn<T> {
	static override readonly [entityKind]: string = 'GelCustomColumn';

	private sqlName: string;
	private mapTo?: (value: T['data']) => T['driverParam'];
	private mapFrom?: (value: T['driverParam']) => T['data'];

	constructor(
		table: AnyGelTable<{ name: T['tableName'] }>,
		config: GelCustomColumnBuilder<T>['config'],
	) {
		super(table, config);
		this.sqlName = config.customTypeParams.dataType(config.fieldConfig);
		this.mapTo = config.customTypeParams.toDriver;
		this.mapFrom = config.customTypeParams.fromDriver;
	}

	getSQLType(): string {
		return this.sqlName;
	}

	override mapFromDriverValue(value: T['driverParam']): T['data'] {
		return typeof this.mapFrom === 'function' ? this.mapFrom(value) : value as T['data'];
	}

	override mapToDriverValue(value: T['data']): T['driverParam'] {
		return typeof this.mapTo === 'function' ? this.mapTo(value) : value as T['data'];
	}
}

Domain

Frequently Asked Questions

What is the GelCustomColumn class?
GelCustomColumn is a class in the drizzle-orm codebase, defined in drizzle-orm/src/gel-core/columns/custom.ts.
Where is GelCustomColumn defined?
GelCustomColumn is defined in drizzle-orm/src/gel-core/columns/custom.ts at line 60.

Analyze Your Own Codebase

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

Try Supermodel Free