Home / Class/ SQLiteTimestamp Class — drizzle-orm Architecture

SQLiteTimestamp Class — drizzle-orm Architecture

Architecture documentation for the SQLiteTimestamp class in integer.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  baec07fc_f2c9_69ae_a840_65807f725dd1["SQLiteTimestamp"]
  29728329_4422_ca9a_2652_18e0b18797f4["integer.ts"]
  baec07fc_f2c9_69ae_a840_65807f725dd1 -->|defined in| 29728329_4422_ca9a_2652_18e0b18797f4
  04a770f0_eb6e_31af_273a_2e3fa9a4b03c["mapFromDriverValue()"]
  baec07fc_f2c9_69ae_a840_65807f725dd1 -->|method| 04a770f0_eb6e_31af_273a_2e3fa9a4b03c
  1c221094_2b4b_2ee3_338e_e77bc620a3b3["mapToDriverValue()"]
  baec07fc_f2c9_69ae_a840_65807f725dd1 -->|method| 1c221094_2b4b_2ee3_338e_e77bc620a3b3

Relationship Graph

Source Code

drizzle-orm/src/sqlite-core/columns/integer.ts lines 136–157

export class SQLiteTimestamp<T extends ColumnBaseConfig<'date', 'SQLiteTimestamp'>>
	extends SQLiteBaseInteger<T, { mode: 'timestamp' | 'timestamp_ms' }>
{
	static override readonly [entityKind]: string = 'SQLiteTimestamp';

	readonly mode: 'timestamp' | 'timestamp_ms' = this.config.mode;

	override mapFromDriverValue(value: number): Date {
		if (this.config.mode === 'timestamp') {
			return new Date(value * 1000);
		}
		return new Date(value);
	}

	override mapToDriverValue(value: Date): number {
		const unix = value.getTime();
		if (this.config.mode === 'timestamp') {
			return Math.floor(unix / 1000);
		}
		return unix;
	}
}

Domain

Frequently Asked Questions

What is the SQLiteTimestamp class?
SQLiteTimestamp is a class in the drizzle-orm codebase, defined in drizzle-orm/src/sqlite-core/columns/integer.ts.
Where is SQLiteTimestamp defined?
SQLiteTimestamp is defined in drizzle-orm/src/sqlite-core/columns/integer.ts at line 136.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free