MCPcopy
hub / github.com/drizzle-team/drizzle-orm / or

Function or

drizzle-orm/src/sql/expressions/conditions.ts:144–164  ·  view source on GitHub ↗
(
	...unfilteredConditions: (SQLWrapper | undefined)[]
)

Source from the content-addressed store, hash-verified

142 */
143export function or(...conditions: (SQLWrapper | undefined)[]): SQL | undefined;
144export function or(
145 ...unfilteredConditions: (SQLWrapper | undefined)[]
146): SQL | undefined {
147 const conditions = unfilteredConditions.filter(
148 (c): c is Exclude<typeof c, undefined> => c !== undefined,
149 );
150
151 if (conditions.length === 0) {
152 return undefined;
153 }
154
155 if (conditions.length === 1) {
156 return new SQL(conditions);
157 }
158
159 return new SQL([
160 new StringChunk('('),
161 sql.join(conditions, new StringChunk(' or ')),
162 new StringChunk(')'),
163 ]);
164}
165
166/**
167 * Negate the meaning of an expression using the `not` keyword.

Callers 15

mysql.test.tsFile · 0.90
pg.test.tsFile · 0.90
turso.test.tsFile · 0.90
vercel.test.tsFile · 0.90
testsFunction · 0.90
gel.test.tsFile · 0.90
bun-sql.test.tsFile · 0.90
select.tsFile · 0.90
select.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected