drizzle-team / drizzle-orm

Headless TypeScript ORM with a head. Runs on Node, Bun and Deno. Lives on the Edge and yes, it's a JavaScript ORM too 😅
https://orm.drizzle.team
Apache License 2.0
21.52k stars 487 forks source link

[FEATURE]: Allow undefined inside union() #2406

Open sp88011 opened 1 month ago

sp88011 commented 1 month ago

Describe what you want

It should be possible to do union(query1, query2, undefined).

This would enable conditional logic in the same vein it's possible to use it in filters (e.g. where(and(eq(id, 1), undefined))

A side requirement of allowing undefined inside union() would be to allow passing just 1 argument to union(). Right now, it expects 2.