Home / Class/ SQLiteTimestampBuilder Class — drizzle-orm Architecture

SQLiteTimestampBuilder Class — drizzle-orm Architecture

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

Entity Profile

Dependency Diagram

graph TD
  d214c861_c271_4445_44d2_e13d7368711f["SQLiteTimestampBuilder"]
  29728329_4422_ca9a_2652_18e0b18797f4["integer.ts"]
  d214c861_c271_4445_44d2_e13d7368711f -->|defined in| 29728329_4422_ca9a_2652_18e0b18797f4
  51afabf1_9f4e_6fef_3f47_0d5a2ee40f88["constructor()"]
  d214c861_c271_4445_44d2_e13d7368711f -->|method| 51afabf1_9f4e_6fef_3f47_0d5a2ee40f88
  fff33e26_893f_8246_5785_ae9a78e19ca5["defaultNow()"]
  d214c861_c271_4445_44d2_e13d7368711f -->|method| fff33e26_893f_8246_5785_ae9a78e19ca5
  f2b655d9_5727_3e50_cfe0_c963d1d4cf7e["build()"]
  d214c861_c271_4445_44d2_e13d7368711f -->|method| f2b655d9_5727_3e50_cfe0_c963d1d4cf7e

Relationship Graph

Source Code

drizzle-orm/src/sqlite-core/columns/integer.ts lines 107–134

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

	constructor(name: T['name'], mode: 'timestamp' | 'timestamp_ms') {
		super(name, 'date', 'SQLiteTimestamp');
		this.config.mode = mode;
	}

	/**
	 * @deprecated Use `default()` with your own expression instead.
	 *
	 * Adds `DEFAULT (cast((julianday('now') - 2440587.5)*86400000 as integer))` to the column, which is the current epoch timestamp in milliseconds.
	 */
	defaultNow(): HasDefault<this> {
		return this.default(sql`(cast((julianday('now') - 2440587.5)*86400000 as integer))`) as any;
	}

	build<TTableName extends string>(
		table: AnySQLiteTable<{ name: TTableName }>,
	): SQLiteTimestamp<MakeColumnConfig<T, TTableName>> {
		return new SQLiteTimestamp<MakeColumnConfig<T, TTableName>>(
			table,
			this.config as ColumnBuilderRuntimeConfig<any, any>,
		);
	}
}

Domain

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free