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

conditions.ts — drizzle-orm Source File

Architecture documentation for conditions.ts, a typescript file in the drizzle-orm codebase. 11 imports, 0 dependents.

File typescript DrizzleORM QueryBuilders 11 imports 25 functions

Entity Profile

Dependency Diagram

graph LR
  e5738c6c_ed59_b79d_2ec8_4635fc6e3bdf["conditions.ts"]
  abaeacd5_4d4a_b271_804c_da0ad56ce45f["sql.ts"]
  e5738c6c_ed59_b79d_2ec8_4635fc6e3bdf --> abaeacd5_4d4a_b271_804c_da0ad56ce45f
  6bcd5337_3216_3499_6684_862bcd7f38c5["isDriverValueEncoder"]
  e5738c6c_ed59_b79d_2ec8_4635fc6e3bdf --> 6bcd5337_3216_3499_6684_862bcd7f38c5
  621db5df_3e56_8859_afe6_1161b6d259d5["isSQLWrapper"]
  e5738c6c_ed59_b79d_2ec8_4635fc6e3bdf --> 621db5df_3e56_8859_afe6_1161b6d259d5
  b19bba6f_09d8_fb73_ca7d_577a3483d281["Param"]
  e5738c6c_ed59_b79d_2ec8_4635fc6e3bdf --> b19bba6f_09d8_fb73_ca7d_577a3483d281
  4c9cea25_0beb_c5c5_be5e_12e191fa54bf["Placeholder"]
  e5738c6c_ed59_b79d_2ec8_4635fc6e3bdf --> 4c9cea25_0beb_c5c5_be5e_12e191fa54bf
  145732b6_cfb1_c458_5e42_b4ae505a59fe["SQL"]
  e5738c6c_ed59_b79d_2ec8_4635fc6e3bdf --> 145732b6_cfb1_c458_5e42_b4ae505a59fe
  fa36dc78_3a13_8a71_038a_83a5f175e9b4["sql"]
  e5738c6c_ed59_b79d_2ec8_4635fc6e3bdf --> fa36dc78_3a13_8a71_038a_83a5f175e9b4
  907998a3_b89a_d83b_55ab_f91b38de4601["StringChunk"]
  e5738c6c_ed59_b79d_2ec8_4635fc6e3bdf --> 907998a3_b89a_d83b_55ab_f91b38de4601
  52cabd36_d0c9_d018_35bc_6856fc89d73f["column.ts"]
  e5738c6c_ed59_b79d_2ec8_4635fc6e3bdf --> 52cabd36_d0c9_d018_35bc_6856fc89d73f
  9347c3af_060d_bd99_cd17_d7f17fadf7cb["entity.ts"]
  e5738c6c_ed59_b79d_2ec8_4635fc6e3bdf --> 9347c3af_060d_bd99_cd17_d7f17fadf7cb
  35d7bc63_23df_58be_e524_e01fab9a4a61["table.ts"]
  e5738c6c_ed59_b79d_2ec8_4635fc6e3bdf --> 35d7bc63_23df_58be_e524_e01fab9a4a61
  style e5738c6c_ed59_b79d_2ec8_4635fc6e3bdf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { type AnyColumn, Column, type GetColumnData } from '~/column.ts';
import { is } from '~/entity.ts';
import { Table } from '~/table.ts';
import {
	isDriverValueEncoder,
	isSQLWrapper,
	Param,
	Placeholder,
	SQL,
	sql,
	type SQLChunk,
	type SQLWrapper,
	StringChunk,
	View,
} from '../sql.ts';

export function bindIfParam(value: unknown, column: SQLWrapper): SQLChunk {
	if (
		isDriverValueEncoder(column)
		&& !isSQLWrapper(value)
		&& !is(value, Param)
		&& !is(value, Placeholder)
		&& !is(value, Column)
		&& !is(value, Table)
		&& !is(value, View)
	) {
		return new Param(value, column);
	}
	return value as SQLChunk;
}

export interface BinaryOperator {
	<TColumn extends Column>(
		left: TColumn,
		right: GetColumnData<TColumn, 'raw'> | SQLWrapper,
	): SQL;
	<T>(left: SQL.Aliased<T>, right: T | SQLWrapper): SQL;
	<T extends SQLWrapper>(
		left: Exclude<T, SQL.Aliased | Column>,
		right: unknown,
	): SQL;
}

/**
 * Test that two values are equal.
 *
 * Remember that the SQL standard dictates that
 * two NULL values are not equal, so if you want to test
 * whether a value is null, you may want to use
 * `isNull` instead.
 *
 * ## Examples
 *
 * ```ts
 * // Select cars made by Ford
 * db.select().from(cars)
 *   .where(eq(cars.make, 'Ford'))
 * ```
 *
 * @see isNull for a way to test equality to NULL.
// ... (681 more lines)

Domain

Subdomains

Frequently Asked Questions

What does conditions.ts do?
conditions.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain, QueryBuilders subdomain.
What functions are defined in conditions.ts?
conditions.ts defines 25 function(s): and, arrayContained, arrayContains, arrayOverlaps, between, bindIfParam, eq, exists, gt, gte, and 15 more.
What does conditions.ts depend on?
conditions.ts imports 11 module(s): Param, Placeholder, SQL, StringChunk, column.ts, entity.ts, isDriverValueEncoder, isSQLWrapper, and 3 more.
Where is conditions.ts in the architecture?
conditions.ts is located at drizzle-orm/src/sql/expressions/conditions.ts (domain: DrizzleORM, subdomain: QueryBuilders, directory: drizzle-orm/src/sql/expressions).

Analyze Your Own Codebase

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

Try Supermodel Free