Home / File/ integer.ts — drizzle-orm Source File

integer.ts — drizzle-orm Source File

Architecture documentation for integer.ts, a typescript file in the drizzle-orm codebase. 9 imports, 1 dependents.

File typescript DrizzleORM SQLDialects 9 imports 1 dependents 1 functions 6 classes

Entity Profile

Dependency Diagram

graph LR
  29728329_4422_ca9a_2652_18e0b18797f4["integer.ts"]
  64ae061d_ed9a_c5f9_235a_3f31995a8d54["table.ts"]
  29728329_4422_ca9a_2652_18e0b18797f4 --> 64ae061d_ed9a_c5f9_235a_3f31995a8d54
  a4c1e5cb_a206_4786_985b_0e0a35ddd536["common.ts"]
  29728329_4422_ca9a_2652_18e0b18797f4 --> a4c1e5cb_a206_4786_985b_0e0a35ddd536
  f78ef1e1_d140_1e8a_3de5_d93a866c939f["SQLiteColumn"]
  29728329_4422_ca9a_2652_18e0b18797f4 --> f78ef1e1_d140_1e8a_3de5_d93a866c939f
  2dc784c6_95e9_4e28_ec81_7caf4acbd426["column-builder.ts"]
  29728329_4422_ca9a_2652_18e0b18797f4 --> 2dc784c6_95e9_4e28_ec81_7caf4acbd426
  05f0a280_d0c9_693a_a4bf_83cc671012d2["column.ts"]
  29728329_4422_ca9a_2652_18e0b18797f4 --> 05f0a280_d0c9_693a_a4bf_83cc671012d2
  27705a9d_afe9_57dd_8c97_e52d8a67d426["entity.ts"]
  29728329_4422_ca9a_2652_18e0b18797f4 --> 27705a9d_afe9_57dd_8c97_e52d8a67d426
  be483a7f_d5d7_7a9b_9a13_44a4a6aafbbd["sql.ts"]
  29728329_4422_ca9a_2652_18e0b18797f4 --> be483a7f_d5d7_7a9b_9a13_44a4a6aafbbd
  11393f8e_d855_f41f_4acb_17acfb1223a6["utils.ts"]
  29728329_4422_ca9a_2652_18e0b18797f4 --> 11393f8e_d855_f41f_4acb_17acfb1223a6
  ecce3253_1e75_a87f_27b3_ca87e81a3024["utils.ts"]
  29728329_4422_ca9a_2652_18e0b18797f4 --> ecce3253_1e75_a87f_27b3_ca87e81a3024
  0bca2cbd_0e97_da69_ba34_0de360b77802["all.ts"]
  0bca2cbd_0e97_da69_ba34_0de360b77802 --> 29728329_4422_ca9a_2652_18e0b18797f4
  style 29728329_4422_ca9a_2652_18e0b18797f4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type {
	ColumnBuilderBaseConfig,
	ColumnBuilderRuntimeConfig,
	ColumnDataType,
	HasDefault,
	IsPrimaryKey,
	MakeColumnConfig,
	NotNull,
} from '~/column-builder.ts';
import type { ColumnBaseConfig } from '~/column.ts';
import { entityKind } from '~/entity.ts';
import { sql } from '~/sql/sql.ts';
import type { OnConflict } from '~/sqlite-core/utils.ts';
import { type Equal, getColumnNameAndConfig, type Or } from '~/utils.ts';
import type { AnySQLiteTable } from '../table.ts';
import { SQLiteColumn, SQLiteColumnBuilder } from './common.ts';

export interface PrimaryKeyConfig {
	autoIncrement?: boolean;
	onConflict?: OnConflict;
}

export abstract class SQLiteBaseIntegerBuilder<
	T extends ColumnBuilderBaseConfig<ColumnDataType, string>,
	TRuntimeConfig extends object = object,
> extends SQLiteColumnBuilder<
	T,
	TRuntimeConfig & { autoIncrement: boolean },
	{},
	{ primaryKeyHasDefault: true }
> {
	static override readonly [entityKind]: string = 'SQLiteBaseIntegerBuilder';

	constructor(name: T['name'], dataType: T['dataType'], columnType: T['columnType']) {
		super(name, dataType, columnType);
		this.config.autoIncrement = false;
	}

	override primaryKey(config?: PrimaryKeyConfig): IsPrimaryKey<HasDefault<NotNull<this>>> {
		if (config?.autoIncrement) {
			this.config.autoIncrement = true;
		}
		this.config.hasDefault = true;
		return super.primaryKey() as IsPrimaryKey<HasDefault<NotNull<this>>>;
	}

	/** @internal */
	abstract override build<TTableName extends string>(
		table: AnySQLiteTable<{ name: TTableName }>,
	): SQLiteBaseInteger<MakeColumnConfig<T, TTableName>>;
}

export abstract class SQLiteBaseInteger<
	T extends ColumnBaseConfig<ColumnDataType, string>,
	TRuntimeConfig extends object = object,
> extends SQLiteColumn<T, TRuntimeConfig & { autoIncrement: boolean }> {
	static override readonly [entityKind]: string = 'SQLiteBaseInteger';

	readonly autoIncrement: boolean = this.config.autoIncrement;

// ... (178 more lines)

Domain

Subdomains

Functions

Dependencies

Frequently Asked Questions

What does integer.ts do?
integer.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain, SQLDialects subdomain.
What functions are defined in integer.ts?
integer.ts defines 1 function(s): integer.
What does integer.ts depend on?
integer.ts imports 9 module(s): SQLiteColumn, column-builder.ts, column.ts, common.ts, entity.ts, sql.ts, table.ts, utils.ts, and 1 more.
What files import integer.ts?
integer.ts is imported by 1 file(s): all.ts.
Where is integer.ts in the architecture?
integer.ts is located at drizzle-orm/src/sqlite-core/columns/integer.ts (domain: DrizzleORM, subdomain: SQLDialects, directory: drizzle-orm/src/sqlite-core/columns).

Analyze Your Own Codebase

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

Try Supermodel Free