What is the best way to create conditional filters on a query?
I am building an marketplace for rural real estate.
I would like to build a filter system with multiple options to filter.
What would be the best way to do this with Drizzle?
It would be like Airbnb.
4 Replies
The best practice is to construct an array of filters that you'l like include using your logic, and then spread that array to the
and()
functionCan you provide an example?
GitHub
[FEATURE]: Merge multiple calls to
where
when in dynamic mode · I...Describe what you want It would be great if multiple calls to the where method could be merged with an and when the query was in dynamic mode. This would be fantastic for scenarios where you want t...
Here's another one: https://github.com/drizzle-team/drizzle-orm/issues/720#issuecomment-1580781923
GitHub
[FEATURE]: Allow adding filters based on conditions · Issue #720 · ...
Describe want to want In real world, it is very rare to just fetch stuff from database in one go using pre defined filters and send it to client. There are many complex conditions which needs to be...