optional join

it would be nice if we could do something similar to the where function, where if we return undefined, nothing happens, to do optional joins.
5 Replies
Angelelz
Angelelz•14mo ago
Yeah, optional joins are kinda complicated, specially the typing You'll have to create some generic parameter to make sure you have the correct type at the end
itsyoboieltr
itsyoboieltrOP•14mo ago
I wonder if it would even be possible? nevertheless, it would be a nice QOL feature
Angelelz
Angelelz•14mo ago
I should be possible with some generic typescript magic You could add an issue in GH, but I'll guess it won't be priority
itsyoboieltr
itsyoboieltrOP•14mo ago
makes sense, I'll add it just to keep it in mind
itsyoboieltr
itsyoboieltrOP•14mo ago
GitHub
[FEATURE]: Optional joins · Issue #1533 · drizzle-team/drizzle-orm
Describe what you want Similar to the where function, I would like to be able to join optionally, based on a condition. db .select() .from(table) .where(condition ? eq(...) : undefined) Proposed ap...
Want results from more Discord servers?
Add your server