CustomTypeParams Type — drizzle-orm Architecture
Architecture documentation for the CustomTypeParams type/interface in custom.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 1297c28b_8650_a711_c510_1bb4301064fa["CustomTypeParams"] 93e79285_19cd_4939_7e23_416703743740["custom.ts"] 1297c28b_8650_a711_c510_1bb4301064fa -->|defined in| 93e79285_19cd_4939_7e23_416703743740 style 1297c28b_8650_a711_c510_1bb4301064fa fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-orm/src/mysql-core/columns/custom.ts lines 143–198
export interface CustomTypeParams<T extends CustomTypeValues> {
/**
* Database data type string representation, that is used for migrations
* @example
* ```
* `jsonb`, `text`
* ```
*
* If database data type needs additional params you can use them from `config` param
* @example
* ```
* `varchar(256)`, `numeric(2,3)`
* ```
*
* To make `config` be of specific type please use config generic in {@link CustomTypeValues}
*
* @example
* Usage example
* ```
* dataType() {
* return 'boolean';
* },
* ```
* Or
* ```
* dataType(config) {
* return typeof config.length !== 'undefined' ? `varchar(${config.length})` : `varchar`;
* }
* ```
*/
dataType: (config: T['config'] | (Equal<T['configRequired'], true> extends true ? never : undefined)) => string;
/**
* Optional mapping function, between user input and driver
* @example
* For example, when using jsonb we need to map JS/TS object to string before writing to database
* ```
* toDriver(value: TData): string {
* return JSON.stringify(value);
* }
* ```
*/
toDriver?: (value: T['data']) => T['driverData'] | SQL;
/**
* Optional mapping function, that is responsible for data mapping from database to JS/TS code
* @example
* For example, when using timestamp we need to map string Date representation to JS Date
* ```
* fromDriver(value: string): Date {
* return new Date(value);
* },
* ```
*/
fromDriver?: (value: T['driverData']) => T['data'];
}
Defined In
Source
Frequently Asked Questions
What is the CustomTypeParams type?
CustomTypeParams is a type/interface in the drizzle-orm codebase, defined in drizzle-orm/src/mysql-core/columns/custom.ts.
Where is CustomTypeParams defined?
CustomTypeParams is defined in drizzle-orm/src/mysql-core/columns/custom.ts at line 143.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free