Home / File/ boolean.ts — drizzle-orm Source File

boolean.ts — drizzle-orm Source File

Architecture documentation for boolean.ts, a typescript file in the drizzle-orm codebase. 6 imports, 1 dependents.

File typescript DrizzleORM SQLDialects 6 imports 1 dependents 1 functions 2 classes

Entity Profile

Dependency Diagram

graph LR
  c257f89c_b156_e22a_3b01_ab9c999baabe["boolean.ts"]
  83c65ad5_22a0_d33f_47b8_c2ed1c8d8bbb["common.ts"]
  c257f89c_b156_e22a_3b01_ab9c999baabe --> 83c65ad5_22a0_d33f_47b8_c2ed1c8d8bbb
  8da43de9_1be1_48fb_1db1_a6bc59f5b306["MySqlColumn"]
  c257f89c_b156_e22a_3b01_ab9c999baabe --> 8da43de9_1be1_48fb_1db1_a6bc59f5b306
  2dc784c6_95e9_4e28_ec81_7caf4acbd426["column-builder.ts"]
  c257f89c_b156_e22a_3b01_ab9c999baabe --> 2dc784c6_95e9_4e28_ec81_7caf4acbd426
  05f0a280_d0c9_693a_a4bf_83cc671012d2["column.ts"]
  c257f89c_b156_e22a_3b01_ab9c999baabe --> 05f0a280_d0c9_693a_a4bf_83cc671012d2
  27705a9d_afe9_57dd_8c97_e52d8a67d426["entity.ts"]
  c257f89c_b156_e22a_3b01_ab9c999baabe --> 27705a9d_afe9_57dd_8c97_e52d8a67d426
  70e1783e_f575_ccd4_36bd_5f0978c2172c["table.ts"]
  c257f89c_b156_e22a_3b01_ab9c999baabe --> 70e1783e_f575_ccd4_36bd_5f0978c2172c
  6dd15b44_b15c_62ef_81b2_e72b28299be9["all.ts"]
  6dd15b44_b15c_62ef_81b2_e72b28299be9 --> c257f89c_b156_e22a_3b01_ab9c999baabe
  style c257f89c_b156_e22a_3b01_ab9c999baabe fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';
import type { ColumnBaseConfig } from '~/column.ts';
import { entityKind } from '~/entity.ts';
import type { AnyMySqlTable } from '~/mysql-core/table.ts';
import { MySqlColumn, MySqlColumnBuilder } from './common.ts';

export type MySqlBooleanBuilderInitial<TName extends string> = MySqlBooleanBuilder<{
	name: TName;
	dataType: 'boolean';
	columnType: 'MySqlBoolean';
	data: boolean;
	driverParam: number | boolean;
	enumValues: undefined;
}>;

export class MySqlBooleanBuilder<T extends ColumnBuilderBaseConfig<'boolean', 'MySqlBoolean'>>
	extends MySqlColumnBuilder<T>
{
	static override readonly [entityKind]: string = 'MySqlBooleanBuilder';

	constructor(name: T['name']) {
		super(name, 'boolean', 'MySqlBoolean');
	}

	/** @internal */
	override build<TTableName extends string>(
		table: AnyMySqlTable<{ name: TTableName }>,
	): MySqlBoolean<MakeColumnConfig<T, TTableName>> {
		return new MySqlBoolean<MakeColumnConfig<T, TTableName>>(
			table,
			this.config as ColumnBuilderRuntimeConfig<any, any>,
		);
	}
}

export class MySqlBoolean<T extends ColumnBaseConfig<'boolean', 'MySqlBoolean'>> extends MySqlColumn<T> {
	static override readonly [entityKind]: string = 'MySqlBoolean';

	getSQLType(): string {
		return 'boolean';
	}

	override mapFromDriverValue(value: number | boolean): boolean {
		if (typeof value === 'boolean') {
			return value;
		}
		return value === 1;
	}
}

export function boolean(): MySqlBooleanBuilderInitial<''>;
export function boolean<TName extends string>(name: TName): MySqlBooleanBuilderInitial<TName>;
export function boolean(name?: string) {
	return new MySqlBooleanBuilder(name ?? '');
}

Domain

Subdomains

Functions

Dependencies

Frequently Asked Questions

What does boolean.ts do?
boolean.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain, SQLDialects subdomain.
What functions are defined in boolean.ts?
boolean.ts defines 1 function(s): boolean.
What does boolean.ts depend on?
boolean.ts imports 6 module(s): MySqlColumn, column-builder.ts, column.ts, common.ts, entity.ts, table.ts.
What files import boolean.ts?
boolean.ts is imported by 1 file(s): all.ts.
Where is boolean.ts in the architecture?
boolean.ts is located at drizzle-orm/src/mysql-core/columns/boolean.ts (domain: DrizzleORM, subdomain: SQLDialects, directory: drizzle-orm/src/mysql-core/columns).

Analyze Your Own Codebase

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

Try Supermodel Free