numeric.ts — drizzle-orm Source File
Architecture documentation for numeric.ts, a typescript file in the drizzle-orm codebase. 7 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR b02d9686_b68f_1cdd_74bf_e7c79bb754fb["numeric.ts"] f4f42b4c_8610_03dd_fe01_232098668127["common.ts"] b02d9686_b68f_1cdd_74bf_e7c79bb754fb --> f4f42b4c_8610_03dd_fe01_232098668127 099d7c6d_2fc4_7b20_40e3_1b8af4138fe6["PgColumn"] b02d9686_b68f_1cdd_74bf_e7c79bb754fb --> 099d7c6d_2fc4_7b20_40e3_1b8af4138fe6 2dc784c6_95e9_4e28_ec81_7caf4acbd426["column-builder.ts"] b02d9686_b68f_1cdd_74bf_e7c79bb754fb --> 2dc784c6_95e9_4e28_ec81_7caf4acbd426 05f0a280_d0c9_693a_a4bf_83cc671012d2["column.ts"] b02d9686_b68f_1cdd_74bf_e7c79bb754fb --> 05f0a280_d0c9_693a_a4bf_83cc671012d2 27705a9d_afe9_57dd_8c97_e52d8a67d426["entity.ts"] b02d9686_b68f_1cdd_74bf_e7c79bb754fb --> 27705a9d_afe9_57dd_8c97_e52d8a67d426 17418917_ff81_c4e5_90f4_f37d557e5d51["table.ts"] b02d9686_b68f_1cdd_74bf_e7c79bb754fb --> 17418917_ff81_c4e5_90f4_f37d557e5d51 ecce3253_1e75_a87f_27b3_ca87e81a3024["utils.ts"] b02d9686_b68f_1cdd_74bf_e7c79bb754fb --> ecce3253_1e75_a87f_27b3_ca87e81a3024 b38cf654_48d6_41dc_6c0f_203697984d98["all.ts"] b38cf654_48d6_41dc_6c0f_203697984d98 --> b02d9686_b68f_1cdd_74bf_e7c79bb754fb style b02d9686_b68f_1cdd_74bf_e7c79bb754fb 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 { type Equal, getColumnNameAndConfig } from '~/utils.ts';
import { PgColumn, PgColumnBuilder } from './common.ts';
export type PgNumericBuilderInitial<TName extends string> = PgNumericBuilder<{
name: TName;
dataType: 'string';
columnType: 'PgNumeric';
data: string;
driverParam: string;
enumValues: undefined;
}>;
export class PgNumericBuilder<T extends ColumnBuilderBaseConfig<'string', 'PgNumeric'>> extends PgColumnBuilder<
T,
{
precision: number | undefined;
scale: number | undefined;
}
> {
static override readonly [entityKind]: string = 'PgNumericBuilder';
constructor(name: T['name'], precision?: number, scale?: number) {
super(name, 'string', 'PgNumeric');
this.config.precision = precision;
this.config.scale = scale;
}
/** @internal */
override build<TTableName extends string>(
table: AnyPgTable<{ name: TTableName }>,
): PgNumeric<MakeColumnConfig<T, TTableName>> {
return new PgNumeric<MakeColumnConfig<T, TTableName>>(table, this.config as ColumnBuilderRuntimeConfig<any, any>);
}
}
export class PgNumeric<T extends ColumnBaseConfig<'string', 'PgNumeric'>> extends PgColumn<T> {
static override readonly [entityKind]: string = 'PgNumeric';
readonly precision: number | undefined;
readonly scale: number | undefined;
constructor(table: AnyPgTable<{ name: T['tableName'] }>, config: PgNumericBuilder<T>['config']) {
super(table, config);
this.precision = config.precision;
this.scale = config.scale;
}
override mapFromDriverValue(value: unknown): string {
if (typeof value === 'string') return value;
return String(value);
}
getSQLType(): string {
if (this.precision !== undefined && this.scale !== undefined) {
return `numeric(${this.precision}, ${this.scale})`;
// ... (168 more lines)
Domain
Subdomains
Functions
Classes
Types
Imported By
Source
Frequently Asked Questions
What does numeric.ts do?
numeric.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 numeric.ts?
numeric.ts defines 1 function(s): numeric.
What does numeric.ts depend on?
numeric.ts imports 7 module(s): PgColumn, column-builder.ts, column.ts, common.ts, entity.ts, table.ts, utils.ts.
What files import numeric.ts?
numeric.ts is imported by 1 file(s): all.ts.
Where is numeric.ts in the architecture?
numeric.ts is located at drizzle-orm/src/pg-core/columns/numeric.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