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

or() — drizzle-orm Function Reference

Architecture documentation for the or() function in conditions.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  78d1cc66_0fa2_7769_d4c0_0c702150d301["or()"]
  57e6e1af_7162_5b6e_bfcf_9d9935f60d31["conditions.ts"]
  78d1cc66_0fa2_7769_d4c0_0c702150d301 -->|defined in| 57e6e1af_7162_5b6e_bfcf_9d9935f60d31
  d6f243fd_6cbd_d4f3_d0bc_78f4860f53cb["join()"]
  78d1cc66_0fa2_7769_d4c0_0c702150d301 -->|calls| d6f243fd_6cbd_d4f3_d0bc_78f4860f53cb
  style 78d1cc66_0fa2_7769_d4c0_0c702150d301 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-orm/src/sql/expressions/conditions.ts lines 144–164

export function or(
	...unfilteredConditions: (SQLWrapper | undefined)[]
): SQL | undefined {
	const conditions = unfilteredConditions.filter(
		(c): c is Exclude<typeof c, undefined> => c !== undefined,
	);

	if (conditions.length === 0) {
		return undefined;
	}

	if (conditions.length === 1) {
		return new SQL(conditions);
	}

	return new SQL([
		new StringChunk('('),
		sql.join(conditions, new StringChunk(' or ')),
		new StringChunk(')'),
	]);
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does or() do?
or() is a function in the drizzle-orm codebase, defined in drizzle-orm/src/sql/expressions/conditions.ts.
Where is or() defined?
or() is defined in drizzle-orm/src/sql/expressions/conditions.ts at line 144.
What does or() call?
or() calls 1 function(s): join.

Analyze Your Own Codebase

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

Try Supermodel Free