numberColumnToSchema() — drizzle-orm Function Reference
Architecture documentation for the numberColumnToSchema() function in column.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 8a7aba84_c937_4ded_8ff0_a5c4b33022b3["numberColumnToSchema()"] 56015c82_287b_9f6e_abba_3d7f471c1e5c["column.ts"] 8a7aba84_c937_4ded_8ff0_a5c4b33022b3 -->|defined in| 56015c82_287b_9f6e_abba_3d7f471c1e5c 06e21ad5_4a79_38ca_ddc3_d0ed3cb1ab5c["columnToSchema()"] 06e21ad5_4a79_38ca_ddc3_d0ed3cb1ab5c -->|calls| 8a7aba84_c937_4ded_8ff0_a5c4b33022b3 7db9c77f_ae87_e998_1bfb_34e9384e09e8["isColumnType()"] 8a7aba84_c937_4ded_8ff0_a5c4b33022b3 -->|calls| 7db9c77f_ae87_e998_1bfb_34e9384e09e8 style 8a7aba84_c937_4ded_8ff0_a5c4b33022b3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-typebox/src/column.ts lines 143–248
function numberColumnToSchema(column: Column, t: typeof typebox): TSchema {
let unsigned = column.getSQLType().includes('unsigned');
let min!: number;
let max!: number;
let integer = false;
if (isColumnType<MySqlTinyInt<any> | SingleStoreTinyInt<any>>(column, ['MySqlTinyInt', 'SingleStoreTinyInt'])) {
min = unsigned ? 0 : CONSTANTS.INT8_MIN;
max = unsigned ? CONSTANTS.INT8_UNSIGNED_MAX : CONSTANTS.INT8_MAX;
integer = true;
} else if (
isColumnType<PgSmallInt<any> | PgSmallSerial<any> | MySqlSmallInt<any> | SingleStoreSmallInt<any>>(column, [
'PgSmallInt',
'PgSmallSerial',
'MySqlSmallInt',
'SingleStoreSmallInt',
])
) {
min = unsigned ? 0 : CONSTANTS.INT16_MIN;
max = unsigned ? CONSTANTS.INT16_UNSIGNED_MAX : CONSTANTS.INT16_MAX;
integer = true;
} else if (
isColumnType<
PgReal<any> | MySqlFloat<any> | MySqlMediumInt<any> | SingleStoreFloat<any> | SingleStoreMediumInt<any>
>(column, [
'PgReal',
'MySqlFloat',
'MySqlMediumInt',
'SingleStoreFloat',
'SingleStoreMediumInt',
])
) {
min = unsigned ? 0 : CONSTANTS.INT24_MIN;
max = unsigned ? CONSTANTS.INT24_UNSIGNED_MAX : CONSTANTS.INT24_MAX;
integer = isColumnType(column, ['MySqlMediumInt', 'SingleStoreMediumInt']);
} else if (
isColumnType<PgInteger<any> | PgSerial<any> | MySqlInt<any> | SingleStoreInt<any>>(column, [
'PgInteger',
'PgSerial',
'MySqlInt',
'SingleStoreInt',
])
) {
min = unsigned ? 0 : CONSTANTS.INT32_MIN;
max = unsigned ? CONSTANTS.INT32_UNSIGNED_MAX : CONSTANTS.INT32_MAX;
integer = true;
} else if (
isColumnType<
| PgDoublePrecision<any>
| MySqlReal<any>
| MySqlDouble<any>
| SingleStoreReal<any>
| SingleStoreDouble<any>
| SQLiteReal<any>
>(column, [
'PgDoublePrecision',
'MySqlReal',
'MySqlDouble',
'SingleStoreReal',
'SingleStoreDouble',
'SQLiteReal',
])
) {
min = unsigned ? 0 : CONSTANTS.INT48_MIN;
max = unsigned ? CONSTANTS.INT48_UNSIGNED_MAX : CONSTANTS.INT48_MAX;
} else if (
isColumnType<
| PgBigInt53<any>
| PgBigSerial53<any>
| MySqlBigInt53<any>
| MySqlSerial<any>
| SingleStoreBigInt53<any>
| SingleStoreSerial<any>
| SQLiteInteger<any>
>(
column,
[
'PgBigInt53',
'PgBigSerial53',
'MySqlBigInt53',
'MySqlSerial',
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does numberColumnToSchema() do?
numberColumnToSchema() is a function in the drizzle-orm codebase, defined in drizzle-typebox/src/column.ts.
Where is numberColumnToSchema() defined?
numberColumnToSchema() is defined in drizzle-typebox/src/column.ts at line 143.
What does numberColumnToSchema() call?
numberColumnToSchema() calls 1 function(s): isColumnType.
What calls numberColumnToSchema()?
numberColumnToSchema() is called by 1 function(s): columnToSchema.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free