PgCustomColumn Class — drizzle-orm Architecture
Architecture documentation for the PgCustomColumn class in custom.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD e38b8925_0ba3_fff9_aafa_6a598e218292["PgCustomColumn"] 2d665331_c10f_e80b_925f_d2148b29ca86["custom.ts"] e38b8925_0ba3_fff9_aafa_6a598e218292 -->|defined in| 2d665331_c10f_e80b_925f_d2148b29ca86 aa9ca753_b1b9_8365_a448_89581f60a5bb["constructor()"] e38b8925_0ba3_fff9_aafa_6a598e218292 -->|method| aa9ca753_b1b9_8365_a448_89581f60a5bb fd609e40_367f_cc43_f59b_e5bd947a1474["getSQLType()"] e38b8925_0ba3_fff9_aafa_6a598e218292 -->|method| fd609e40_367f_cc43_f59b_e5bd947a1474 2862a5c6_1195_fabc_686a_ed2181117a9b["mapFromDriverValue()"] e38b8925_0ba3_fff9_aafa_6a598e218292 -->|method| 2862a5c6_1195_fabc_686a_ed2181117a9b 6f63d6e2_9b8c_839c_144d_0af5e3a22754["mapToDriverValue()"] e38b8925_0ba3_fff9_aafa_6a598e218292 -->|method| 6f63d6e2_9b8c_839c_144d_0af5e3a22754
Relationship Graph
Source Code
drizzle-orm/src/pg-core/columns/custom.ts lines 60–88
export class PgCustomColumn<T extends ColumnBaseConfig<'custom', 'PgCustomColumn'>> extends PgColumn<T> {
static override readonly [entityKind]: string = 'PgCustomColumn';
private sqlName: string;
private mapTo?: (value: T['data']) => T['driverParam'];
private mapFrom?: (value: T['driverParam']) => T['data'];
constructor(
table: AnyPgTable<{ name: T['tableName'] }>,
config: PgCustomColumnBuilder<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 PgCustomColumn class?
PgCustomColumn is a class in the drizzle-orm codebase, defined in drizzle-orm/src/pg-core/columns/custom.ts.
Where is PgCustomColumn defined?
PgCustomColumn is defined in drizzle-orm/src/pg-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