Home / Class/ SingleStoreCustomColumn Class — drizzle-orm Architecture

SingleStoreCustomColumn Class — drizzle-orm Architecture

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

Entity Profile

Dependency Diagram

graph TD
  cad4292d_da95_52fc_9a68_d6941a798725["SingleStoreCustomColumn"]
  8acf7f1c_a3fb_3dd8_17fe_b6f3f78e2a74["custom.ts"]
  cad4292d_da95_52fc_9a68_d6941a798725 -->|defined in| 8acf7f1c_a3fb_3dd8_17fe_b6f3f78e2a74
  7aabcc42_c14c_5f10_571d_55677ae47d1a["constructor()"]
  cad4292d_da95_52fc_9a68_d6941a798725 -->|method| 7aabcc42_c14c_5f10_571d_55677ae47d1a
  d0c8e3aa_ebc8_0ca8_086b_af4719db712c["getSQLType()"]
  cad4292d_da95_52fc_9a68_d6941a798725 -->|method| d0c8e3aa_ebc8_0ca8_086b_af4719db712c
  a369c404_78b9_80e6_5f9c_85b3b74885c1["mapFromDriverValue()"]
  cad4292d_da95_52fc_9a68_d6941a798725 -->|method| a369c404_78b9_80e6_5f9c_85b3b74885c1
  e404ba84_2bad_e6b3_d1ad_dbaad09dc364["mapToDriverValue()"]
  cad4292d_da95_52fc_9a68_d6941a798725 -->|method| e404ba84_2bad_e6b3_d1ad_dbaad09dc364

Relationship Graph

Source Code

drizzle-orm/src/singlestore-core/columns/custom.ts lines 61–91

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

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

	constructor(
		table: AnySingleStoreTable<{ name: T['tableName'] }>,
		config: SingleStoreCustomColumnBuilder<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 SingleStoreCustomColumn class?
SingleStoreCustomColumn is a class in the drizzle-orm codebase, defined in drizzle-orm/src/singlestore-core/columns/custom.ts.
Where is SingleStoreCustomColumn defined?
SingleStoreCustomColumn is defined in drizzle-orm/src/singlestore-core/columns/custom.ts at line 61.

Analyze Your Own Codebase

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

Try Supermodel Free