Conditional join
Hey! I am looking for a way of making conditional joins based on some statement. I found only one post in this topic https://discord.com/channels/1043890932593987624/1128636955270324275 that does not help me much.
lets say this is my query:
I need to make joins conditional, because some filters require joins and in other cases I do not need join so its like wasted computation time. So example showing my need:
I would be glad for any tip how to do this.
5 Replies
Exact same question for me.
Conditional joins would be really useful to have generic functions that can adapt their return value to what the caller needs.
Drizzle ORM - Dynamic query building
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
I've tried every way I could come up with, including with
$dynamic
however the types never end up to be correctyou’ll need dynamic with generics like the example, let me make u a sample when i’m back on computer