Home / Class/ SQLiteCustomColumn Class — drizzle-orm Architecture

SQLiteCustomColumn Class — drizzle-orm Architecture

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

Entity Profile

Dependency Diagram

graph TD
  b00064c3_6cc4_1be1_d8b9_457e068dbdd8["SQLiteCustomColumn"]
  e7326635_a1d9_22bf_400e_da3a7dd63899["custom.ts"]
  b00064c3_6cc4_1be1_d8b9_457e068dbdd8 -->|defined in| e7326635_a1d9_22bf_400e_da3a7dd63899
  79dd3167_a066_827a_dd54_a4e9650f0e38["constructor()"]
  b00064c3_6cc4_1be1_d8b9_457e068dbdd8 -->|method| 79dd3167_a066_827a_dd54_a4e9650f0e38
  e96476bb_45f7_879e_4a64_c34b5c27d00f["getSQLType()"]
  b00064c3_6cc4_1be1_d8b9_457e068dbdd8 -->|method| e96476bb_45f7_879e_4a64_c34b5c27d00f
  2e974859_c15b_4382_fa8f_f7107c668a01["mapFromDriverValue()"]
  b00064c3_6cc4_1be1_d8b9_457e068dbdd8 -->|method| 2e974859_c15b_4382_fa8f_f7107c668a01
  2526d695_73b5_5747_ae01_33666130c31a["mapToDriverValue()"]
  b00064c3_6cc4_1be1_d8b9_457e068dbdd8 -->|method| 2526d695_73b5_5747_ae01_33666130c31a

Relationship Graph

Source Code

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

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

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

	constructor(
		table: AnySQLiteTable<{ name: T['tableName'] }>,
		config: SQLiteCustomColumnBuilder<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 SQLiteCustomColumn class?
SQLiteCustomColumn is a class in the drizzle-orm codebase, defined in drizzle-orm/src/sqlite-core/columns/custom.ts.
Where is SQLiteCustomColumn defined?
SQLiteCustomColumn is defined in drizzle-orm/src/sqlite-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