Home / Function/ parseType() — drizzle-orm Function Reference

parseType() — drizzle-orm Function Reference

Architecture documentation for the parseType() function in sqlgenerator.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  b0591d99_981e_0c05_5ac1_486f87aa1678["parseType()"]
  fe4174c7_3b9c_5b26_98a0_b2395ca21939["sqlgenerator.ts"]
  b0591d99_981e_0c05_5ac1_486f87aa1678 -->|defined in| fe4174c7_3b9c_5b26_98a0_b2395ca21939
  0c0075d1_721b_7330_13f9_51cb37ea219c["convert()"]
  0c0075d1_721b_7330_13f9_51cb37ea219c -->|calls| b0591d99_981e_0c05_5ac1_486f87aa1678
  2d618809_9374_2760_a1b8_aeeeb02ac67c["convert()"]
  2d618809_9374_2760_a1b8_aeeeb02ac67c -->|calls| b0591d99_981e_0c05_5ac1_486f87aa1678
  6b7041f7_5104_2b55_7314_0bd494d2c545["convert()"]
  6b7041f7_5104_2b55_7314_0bd494d2c545 -->|calls| b0591d99_981e_0c05_5ac1_486f87aa1678
  aca821b2_b407_7075_a020_0b97ae4b1e10["convert()"]
  aca821b2_b407_7075_a020_0b97ae4b1e10 -->|calls| b0591d99_981e_0c05_5ac1_486f87aa1678
  style b0591d99_981e_0c05_5ac1_486f87aa1678 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-kit/src/sqlgenerator.ts lines 95–149

const parseType = (schemaPrefix: string, type: string) => {
	const pgNativeTypes = [
		'uuid',
		'smallint',
		'integer',
		'bigint',
		'boolean',
		'text',
		'varchar',
		'serial',
		'bigserial',
		'decimal',
		'numeric',
		'real',
		'json',
		'jsonb',
		'time',
		'time with time zone',
		'time without time zone',
		'time',
		'timestamp',
		'timestamp with time zone',
		'timestamp without time zone',
		'date',
		'interval',
		'bigint',
		'bigserial',
		'double precision',
		'interval year',
		'interval month',
		'interval day',
		'interval hour',
		'interval minute',
		'interval second',
		'interval year to month',
		'interval day to hour',
		'interval day to minute',
		'interval day to second',
		'interval hour to minute',
		'interval hour to second',
		'interval minute to second',
		'char',
		'vector',
		'geometry',
		'halfvec',
		'sparsevec',
		'bit',
	];
	const arrayDefinitionRegex = /\[\d*(?:\[\d*\])*\]/g;
	const arrayDefinition = (type.match(arrayDefinitionRegex) ?? []).join('');
	const withoutArrayDefinition = type.replace(arrayDefinitionRegex, '');
	return pgNativeTypes.some((it) => type.startsWith(it))
		? `${withoutArrayDefinition}${arrayDefinition}`
		: `${schemaPrefix}"${withoutArrayDefinition}"${arrayDefinition}`;
};

Domain

Subdomains

Frequently Asked Questions

What does parseType() do?
parseType() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/sqlgenerator.ts.
Where is parseType() defined?
parseType() is defined in drizzle-kit/src/sqlgenerator.ts at line 95.
What calls parseType()?
parseType() is called by 4 function(s): convert, convert, convert, convert.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free