MySqlCustomColumn Class — drizzle-orm Architecture
Architecture documentation for the MySqlCustomColumn class in custom.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 75e51155_c57f_39a2_2fd6_ab7f572ed32a["MySqlCustomColumn"] 93e79285_19cd_4939_7e23_416703743740["custom.ts"] 75e51155_c57f_39a2_2fd6_ab7f572ed32a -->|defined in| 93e79285_19cd_4939_7e23_416703743740 845eb10e_1dd2_2f47_c78f_f430d37ab022["constructor()"] 75e51155_c57f_39a2_2fd6_ab7f572ed32a -->|method| 845eb10e_1dd2_2f47_c78f_f430d37ab022 4bf7863a_66ef_976a_d503_fc85dc439270["getSQLType()"] 75e51155_c57f_39a2_2fd6_ab7f572ed32a -->|method| 4bf7863a_66ef_976a_d503_fc85dc439270 07ffed30_b360_28a1_5687_ea55e016ecd8["mapFromDriverValue()"] 75e51155_c57f_39a2_2fd6_ab7f572ed32a -->|method| 07ffed30_b360_28a1_5687_ea55e016ecd8 85948f80_d06c_12f4_f3b3_1c43086d366f["mapToDriverValue()"] 75e51155_c57f_39a2_2fd6_ab7f572ed32a -->|method| 85948f80_d06c_12f4_f3b3_1c43086d366f
Relationship Graph
Source Code
drizzle-orm/src/mysql-core/columns/custom.ts lines 60–88
export class MySqlCustomColumn<T extends ColumnBaseConfig<'custom', 'MySqlCustomColumn'>> extends MySqlColumn<T> {
static override readonly [entityKind]: string = 'MySqlCustomColumn';
private sqlName: string;
private mapTo?: (value: T['data']) => T['driverParam'];
private mapFrom?: (value: T['driverParam']) => T['data'];
constructor(
table: AnyMySqlTable<{ name: T['tableName'] }>,
config: MySqlCustomColumnBuilder<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
Defined In
Source
Frequently Asked Questions
What is the MySqlCustomColumn class?
MySqlCustomColumn is a class in the drizzle-orm codebase, defined in drizzle-orm/src/mysql-core/columns/custom.ts.
Where is MySqlCustomColumn defined?
MySqlCustomColumn is defined in drizzle-orm/src/mysql-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