Home / Type/ GetZodType Type — drizzle-orm Architecture

GetZodType Type — drizzle-orm Architecture

Architecture documentation for the GetZodType type/interface in column.types.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  d393631f_590a_171d_60e9_daf2f1a1924a["GetZodType"]
  2be77f5f_e94f_b91a_88e0_947351113ff1["column.types.ts"]
  d393631f_590a_171d_60e9_daf2f1a1924a -->|defined in| 2be77f5f_e94f_b91a_88e0_947351113ff1
  style d393631f_590a_171d_60e9_daf2f1a1924a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-zod/src/column.types.ts lines 10–34

export type GetZodType<
	TColumn extends Column,
	TCoerce extends Partial<Record<'bigint' | 'boolean' | 'date' | 'number' | 'string', true>> | true | undefined,
> = HasBaseColumn<TColumn> extends true ? z.ZodArray<
		GetZodType<Assume<TColumn['_']['baseColumn'], Column>, TCoerce>
	>
	: TColumn['_']['columnType'] extends 'PgUUID' ? z.ZodUUID
	: IsEnumDefined<TColumn['_']['enumValues']> extends true
		? z.ZodEnum<{ [K in Assume<TColumn['_']['enumValues'], [string, ...string[]]>[number]]: K }>
	: TColumn['_']['columnType'] extends 'PgGeometry' | 'PgPointTuple' ? z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>
	: TColumn['_']['columnType'] extends 'PgLine' ? z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>
	: TColumn['_']['data'] extends Date ? CanCoerce<TCoerce, 'date'> extends true ? z.coerce.ZodCoercedDate : z.ZodDate
	: TColumn['_']['data'] extends Buffer ? z.ZodType<Buffer>
	: TColumn['_']['dataType'] extends 'array'
		? z.ZodArray<GetZodPrimitiveType<Assume<TColumn['_']['data'], any[]>[number], '', TCoerce>>
	: TColumn['_']['data'] extends Record<string, any>
		? TColumn['_']['columnType'] extends
			'PgJson' | 'PgJsonb' | 'MySqlJson' | 'SingleStoreJson' | 'SQLiteTextJson' | 'SQLiteBlobJson'
			? z.ZodType<TColumn['_']['data'], TColumn['_']['data']>
		: z.ZodObject<
			{ [K in keyof TColumn['_']['data']]: GetZodPrimitiveType<TColumn['_']['data'][K], '', TCoerce> },
			{ out: {}; in: {} }
		>
	: TColumn['_']['dataType'] extends 'json' ? z.ZodType<Json>
	: GetZodPrimitiveType<TColumn['_']['data'], TColumn['_']['columnType'], TCoerce>;

Frequently Asked Questions

What is the GetZodType type?
GetZodType is a type/interface in the drizzle-orm codebase, defined in drizzle-zod/src/column.types.ts.
Where is GetZodType defined?
GetZodType is defined in drizzle-zod/src/column.types.ts at line 10.

Analyze Your Own Codebase

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

Try Supermodel Free