PgTimestampString Class — drizzle-orm Architecture
Architecture documentation for the PgTimestampString class in timestamp.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 5dafd4db_e70f_41bc_554b_872fae3209da["PgTimestampString"] a7bcec86_fec9_446d_0dc2_721126dd50c7["timestamp.ts"] 5dafd4db_e70f_41bc_554b_872fae3209da -->|defined in| a7bcec86_fec9_446d_0dc2_721126dd50c7 7ff40f34_165d_f134_f535_3285a51b4bb2["constructor()"] 5dafd4db_e70f_41bc_554b_872fae3209da -->|method| 7ff40f34_165d_f134_f535_3285a51b4bb2 8a373000_0682_2557_a5cd_b89d3330ea51["getSQLType()"] 5dafd4db_e70f_41bc_554b_872fae3209da -->|method| 8a373000_0682_2557_a5cd_b89d3330ea51 13d1ea24_6f54_9a64_be6b_382bf562c583["mapFromDriverValue()"] 5dafd4db_e70f_41bc_554b_872fae3209da -->|method| 13d1ea24_6f54_9a64_be6b_382bf562c583
Relationship Graph
Source Code
drizzle-orm/src/pg-core/columns/timestamp.ts lines 110–139
export class PgTimestampString<T extends ColumnBaseConfig<'string', 'PgTimestampString'>> extends PgColumn<T> {
static override readonly [entityKind]: string = 'PgTimestampString';
readonly withTimezone: boolean;
readonly precision: number | undefined;
constructor(table: AnyPgTable<{ name: T['tableName'] }>, config: PgTimestampStringBuilder<T>['config']) {
super(table, config);
this.withTimezone = config.withTimezone;
this.precision = config.precision;
}
getSQLType(): string {
const precision = this.precision === undefined ? '' : `(${this.precision})`;
return `timestamp${precision}${this.withTimezone ? ' with time zone' : ''}`;
}
override mapFromDriverValue(value: Date | string): string {
if (typeof value === 'string') return value;
const shortened = value.toISOString().slice(0, -1).replace('T', ' ');
if (this.withTimezone) {
const offset = value.getTimezoneOffset();
const sign = offset <= 0 ? '+' : '-';
return `${shortened}${sign}${Math.floor(Math.abs(offset) / 60).toString().padStart(2, '0')}`;
}
return shortened;
}
}
Domain
Defined In
Source
Frequently Asked Questions
What is the PgTimestampString class?
PgTimestampString is a class in the drizzle-orm codebase, defined in drizzle-orm/src/pg-core/columns/timestamp.ts.
Where is PgTimestampString defined?
PgTimestampString is defined in drizzle-orm/src/pg-core/columns/timestamp.ts at line 110.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free