PgTimestamp Class — drizzle-orm Architecture
Architecture documentation for the PgTimestamp class in timestamp.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 286e6c00_1dd2_05f1_bc72_442401a4c833["PgTimestamp"] a7bcec86_fec9_446d_0dc2_721126dd50c7["timestamp.ts"] 286e6c00_1dd2_05f1_bc72_442401a4c833 -->|defined in| a7bcec86_fec9_446d_0dc2_721126dd50c7 f3aaf6a3_de52_ce99_5ede_6bcfdca26699["constructor()"] 286e6c00_1dd2_05f1_bc72_442401a4c833 -->|method| f3aaf6a3_de52_ce99_5ede_6bcfdca26699 c44545f7_8019_5e76_41c2_1befe355f962["getSQLType()"] 286e6c00_1dd2_05f1_bc72_442401a4c833 -->|method| c44545f7_8019_5e76_41c2_1befe355f962 ead8b67b_9f9a_d8f2_9aba_6c01eed36aad["mapFromDriverValue()"] 286e6c00_1dd2_05f1_bc72_442401a4c833 -->|method| ead8b67b_9f9a_d8f2_9aba_6c01eed36aad
Relationship Graph
Source Code
drizzle-orm/src/pg-core/columns/timestamp.ts lines 44–70
export class PgTimestamp<T extends ColumnBaseConfig<'date', 'PgTimestamp'>> extends PgColumn<T> {
static override readonly [entityKind]: string = 'PgTimestamp';
readonly withTimezone: boolean;
readonly precision: number | undefined;
constructor(table: AnyPgTable<{ name: T['tableName'] }>, config: PgTimestampBuilder<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): Date {
if (typeof value === 'string') return new Date(this.withTimezone ? value : value + '+0000');
return value;
}
override mapToDriverValue = (value: Date): string => {
return value.toISOString();
};
}
Domain
Defined In
Source
Frequently Asked Questions
What is the PgTimestamp class?
PgTimestamp is a class in the drizzle-orm codebase, defined in drizzle-orm/src/pg-core/columns/timestamp.ts.
Where is PgTimestamp defined?
PgTimestamp is defined in drizzle-orm/src/pg-core/columns/timestamp.ts at line 44.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free