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
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
I wonder if it would even be possible? nevertheless, it would be a nice QOL feature
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
makes sense, I'll add it just to keep it in mind
@Angelelz added 🙂
https://github.com/drizzle-team/drizzle-orm/issues/1533
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...