stringColumnToSchema() — drizzle-orm Function Reference
Architecture documentation for the stringColumnToSchema() function in column.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD acbcd7cb_b64c_26cb_b184_e0445479f034["stringColumnToSchema()"] 03d2f7f9_4592_2641_ed27_5e125e89d737["column.ts"] acbcd7cb_b64c_26cb_b184_e0445479f034 -->|defined in| 03d2f7f9_4592_2641_ed27_5e125e89d737 b1c074f5_2da3_d41e_58f2_747e87ddff7d["columnToSchema()"] b1c074f5_2da3_d41e_58f2_747e87ddff7d -->|calls| acbcd7cb_b64c_26cb_b184_e0445479f034 style acbcd7cb_b64c_26cb_b184_e0445479f034 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-arktype/src/column.ts lines 244–294
function stringColumnToSchema(column: Column): Type {
if (isColumnType<PgUUID<ColumnBaseConfig<'string', 'PgUUID'>>>(column, ['PgUUID'])) {
return type(/^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/iu).describe('a RFC-4122-compliant UUID');
}
if (
isColumnType<
PgBinaryVector<
ColumnBaseConfig<'string', 'PgBinaryVector'> & {
dimensions: number;
}
>
>(column, ['PgBinaryVector'])
) {
return type(`/^[01]{${column.dimensions}}$/`)
.describe(`a string containing ones or zeros while being ${column.dimensions} characters long`);
}
let max: number | undefined;
let fixed = false;
if (isColumnType<PgVarchar<any> | SQLiteText<any>>(column, ['PgVarchar', 'SQLiteText'])) {
max = column.length;
} else if (
isColumnType<MySqlVarChar<any> | SingleStoreVarChar<any>>(column, ['MySqlVarChar', 'SingleStoreVarChar'])
) {
max = column.length ?? CONSTANTS.INT16_UNSIGNED_MAX;
} else if (isColumnType<MySqlText<any> | SingleStoreText<any>>(column, ['MySqlText', 'SingleStoreText'])) {
if (column.textType === 'longtext') {
max = CONSTANTS.INT32_UNSIGNED_MAX;
} else if (column.textType === 'mediumtext') {
max = CONSTANTS.INT24_UNSIGNED_MAX;
} else if (column.textType === 'text') {
max = CONSTANTS.INT16_UNSIGNED_MAX;
} else {
max = CONSTANTS.INT8_UNSIGNED_MAX;
}
}
if (
isColumnType<PgChar<any> | MySqlChar<any> | SingleStoreChar<any>>(column, [
'PgChar',
'MySqlChar',
'SingleStoreChar',
])
) {
max = column.length;
fixed = true;
}
return max && fixed ? type.string.exactlyLength(max) : max ? type.string.atMostLength(max) : type.string;
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does stringColumnToSchema() do?
stringColumnToSchema() is a function in the drizzle-orm codebase, defined in drizzle-arktype/src/column.ts.
Where is stringColumnToSchema() defined?
stringColumnToSchema() is defined in drizzle-arktype/src/column.ts at line 244.
What calls stringColumnToSchema()?
stringColumnToSchema() 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