Home / Class/ MySqlTimestamp Class — drizzle-orm Architecture

MySqlTimestamp Class — drizzle-orm Architecture

Architecture documentation for the MySqlTimestamp class in timestamp.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  5441b4f3_0d16_85e6_e6b4_eb4eb5250ba6["MySqlTimestamp"]
  3f4b2513_5741_1f8c_8c92_e76673d698a6["timestamp.ts"]
  5441b4f3_0d16_85e6_e6b4_eb4eb5250ba6 -->|defined in| 3f4b2513_5741_1f8c_8c92_e76673d698a6
  60d67158_c236_3187_814c_788a1e6c7dcd["getSQLType()"]
  5441b4f3_0d16_85e6_e6b4_eb4eb5250ba6 -->|method| 60d67158_c236_3187_814c_788a1e6c7dcd
  55d5664a_eb39_bf20_f9d4_181482521d7d["mapFromDriverValue()"]
  5441b4f3_0d16_85e6_e6b4_eb4eb5250ba6 -->|method| 55d5664a_eb39_bf20_f9d4_181482521d7d
  bc5954fd_5c83_380e_ddeb_1db6b5d51678["mapToDriverValue()"]
  5441b4f3_0d16_85e6_e6b4_eb4eb5250ba6 -->|method| bc5954fd_5c83_380e_ddeb_1db6b5d51678

Relationship Graph

Source Code

drizzle-orm/src/mysql-core/columns/timestamp.ts lines 38–57

export class MySqlTimestamp<T extends ColumnBaseConfig<'date', 'MySqlTimestamp'>>
	extends MySqlDateBaseColumn<T, MySqlTimestampConfig>
{
	static override readonly [entityKind]: string = 'MySqlTimestamp';

	readonly fsp: number | undefined = this.config.fsp;

	getSQLType(): string {
		const precision = this.fsp === undefined ? '' : `(${this.fsp})`;
		return `timestamp${precision}`;
	}

	override mapFromDriverValue(value: string): Date {
		return new Date(value + '+0000');
	}

	override mapToDriverValue(value: Date): string {
		return value.toISOString().slice(0, -1).replace('T', ' ');
	}
}

Domain

Frequently Asked Questions

What is the MySqlTimestamp class?
MySqlTimestamp is a class in the drizzle-orm codebase, defined in drizzle-orm/src/mysql-core/columns/timestamp.ts.
Where is MySqlTimestamp defined?
MySqlTimestamp is defined in drizzle-orm/src/mysql-core/columns/timestamp.ts at line 38.

Analyze Your Own Codebase

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

Try Supermodel Free