bigint.ts — drizzle-orm Source File
Architecture documentation for bigint.ts, a typescript file in the drizzle-orm codebase. 8 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 9e45dd50_595c_fce2_0195_02a2865c70ed["bigint.ts"] f4f42b4c_8610_03dd_fe01_232098668127["common.ts"] 9e45dd50_595c_fce2_0195_02a2865c70ed --> f4f42b4c_8610_03dd_fe01_232098668127 099d7c6d_2fc4_7b20_40e3_1b8af4138fe6["PgColumn"] 9e45dd50_595c_fce2_0195_02a2865c70ed --> 099d7c6d_2fc4_7b20_40e3_1b8af4138fe6 5e8f073a_0845_8d49_1d60_aeb1c020baaf["int.common.ts"] 9e45dd50_595c_fce2_0195_02a2865c70ed --> 5e8f073a_0845_8d49_1d60_aeb1c020baaf 2dc784c6_95e9_4e28_ec81_7caf4acbd426["column-builder.ts"] 9e45dd50_595c_fce2_0195_02a2865c70ed --> 2dc784c6_95e9_4e28_ec81_7caf4acbd426 05f0a280_d0c9_693a_a4bf_83cc671012d2["column.ts"] 9e45dd50_595c_fce2_0195_02a2865c70ed --> 05f0a280_d0c9_693a_a4bf_83cc671012d2 27705a9d_afe9_57dd_8c97_e52d8a67d426["entity.ts"] 9e45dd50_595c_fce2_0195_02a2865c70ed --> 27705a9d_afe9_57dd_8c97_e52d8a67d426 17418917_ff81_c4e5_90f4_f37d557e5d51["table.ts"] 9e45dd50_595c_fce2_0195_02a2865c70ed --> 17418917_ff81_c4e5_90f4_f37d557e5d51 ecce3253_1e75_a87f_27b3_ca87e81a3024["utils.ts"] 9e45dd50_595c_fce2_0195_02a2865c70ed --> ecce3253_1e75_a87f_27b3_ca87e81a3024 b38cf654_48d6_41dc_6c0f_203697984d98["all.ts"] b38cf654_48d6_41dc_6c0f_203697984d98 --> 9e45dd50_595c_fce2_0195_02a2865c70ed style 9e45dd50_595c_fce2_0195_02a2865c70ed fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';
import type { ColumnBaseConfig } from '~/column.ts';
import { entityKind } from '~/entity.ts';
import type { AnyPgTable } from '~/pg-core/table.ts';
import { getColumnNameAndConfig } from '~/utils.ts';
import { PgColumn } from './common.ts';
import { PgIntColumnBaseBuilder } from './int.common.ts';
export type PgBigInt53BuilderInitial<TName extends string> = PgBigInt53Builder<{
name: TName;
dataType: 'number';
columnType: 'PgBigInt53';
data: number;
driverParam: number | string;
enumValues: undefined;
}>;
export class PgBigInt53Builder<T extends ColumnBuilderBaseConfig<'number', 'PgBigInt53'>>
extends PgIntColumnBaseBuilder<T>
{
static override readonly [entityKind]: string = 'PgBigInt53Builder';
constructor(name: T['name']) {
super(name, 'number', 'PgBigInt53');
}
/** @internal */
override build<TTableName extends string>(
table: AnyPgTable<{ name: TTableName }>,
): PgBigInt53<MakeColumnConfig<T, TTableName>> {
return new PgBigInt53<MakeColumnConfig<T, TTableName>>(table, this.config as ColumnBuilderRuntimeConfig<any, any>);
}
}
export class PgBigInt53<T extends ColumnBaseConfig<'number', 'PgBigInt53'>> extends PgColumn<T> {
static override readonly [entityKind]: string = 'PgBigInt53';
getSQLType(): string {
return 'bigint';
}
override mapFromDriverValue(value: number | string): number {
if (typeof value === 'number') {
return value;
}
return Number(value);
}
}
export type PgBigInt64BuilderInitial<TName extends string> = PgBigInt64Builder<{
name: TName;
dataType: 'bigint';
columnType: 'PgBigInt64';
data: bigint;
driverParam: string;
enumValues: undefined;
}>;
export class PgBigInt64Builder<T extends ColumnBuilderBaseConfig<'bigint', 'PgBigInt64'>>
extends PgIntColumnBaseBuilder<T>
{
static override readonly [entityKind]: string = 'PgBigInt64Builder';
constructor(name: T['name']) {
super(name, 'bigint', 'PgBigInt64');
}
/** @internal */
override build<TTableName extends string>(
table: AnyPgTable<{ name: TTableName }>,
): PgBigInt64<MakeColumnConfig<T, TTableName>> {
return new PgBigInt64<MakeColumnConfig<T, TTableName>>(
table,
this.config as ColumnBuilderRuntimeConfig<any, any>,
);
}
}
export class PgBigInt64<T extends ColumnBaseConfig<'bigint', 'PgBigInt64'>> extends PgColumn<T> {
static override readonly [entityKind]: string = 'PgBigInt64';
getSQLType(): string {
return 'bigint';
}
// eslint-disable-next-line unicorn/prefer-native-coercion-functions
override mapFromDriverValue(value: string): bigint {
return BigInt(value);
}
}
export interface PgBigIntConfig<T extends 'number' | 'bigint' = 'number' | 'bigint'> {
mode: T;
}
export function bigint<TMode extends PgBigIntConfig['mode']>(
config: PgBigIntConfig<TMode>,
): TMode extends 'number' ? PgBigInt53BuilderInitial<''> : PgBigInt64BuilderInitial<''>;
export function bigint<TName extends string, TMode extends PgBigIntConfig['mode']>(
name: TName,
config: PgBigIntConfig<TMode>,
): TMode extends 'number' ? PgBigInt53BuilderInitial<TName> : PgBigInt64BuilderInitial<TName>;
export function bigint(a: string | PgBigIntConfig, b?: PgBigIntConfig) {
const { name, config } = getColumnNameAndConfig<PgBigIntConfig>(a, b);
if (config.mode === 'number') {
return new PgBigInt53Builder(name);
}
return new PgBigInt64Builder(name);
}
Domain
Subdomains
Functions
Dependencies
- PgColumn
- column-builder.ts
- column.ts
- common.ts
- entity.ts
- int.common.ts
- table.ts
- utils.ts
Imported By
Source
Frequently Asked Questions
What does bigint.ts do?
bigint.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain, DatabaseDrivers subdomain.
What functions are defined in bigint.ts?
bigint.ts defines 1 function(s): bigint.
What does bigint.ts depend on?
bigint.ts imports 8 module(s): PgColumn, column-builder.ts, column.ts, common.ts, entity.ts, int.common.ts, table.ts, utils.ts.
What files import bigint.ts?
bigint.ts is imported by 1 file(s): all.ts.
Where is bigint.ts in the architecture?
bigint.ts is located at drizzle-orm/src/pg-core/columns/bigint.ts (domain: DrizzleORM, subdomain: DatabaseDrivers, directory: drizzle-orm/src/pg-core/columns).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free