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

and() — drizzle-orm Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

drizzle-orm/src/sql/expressions/conditions.ts lines 105–125

export function and(
	...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(' and ')),
		new StringChunk(')'),
	]);
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does and() do?
and() is a function in the drizzle-orm codebase, defined in drizzle-orm/src/sql/expressions/conditions.ts.
Where is and() defined?
and() is defined in drizzle-orm/src/sql/expressions/conditions.ts at line 105.
What does and() call?
and() 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