How to call a method based on a condition?
I am running two almost similar queries based on a condition. In one of the condition I'm calling the where method and in the other one I'm not. How can I reduce duplicacy by having just one query that works for both conditions? Basically calling the where method only if a condition holds.
1 Reply
uh
you can build the query in progress
i.e.
let query = <first bit>; if (condition) query = query.where....; await query.<last bit>