It is often necessary to create queries that varies depending on values
known only at runtime.
The method inhibitWhen(b: Boolean) available on
is meant to be called in a from clause, it will turn a Table[A] or
into a Queryable[Option[A]] and remove the queryable from the
and all expression referencing this queryable.
Notice the Option in the result type of the query, and how the
table disappears from the generated SQL base on the input of
h3. Dynamic Where clause construction
The following method builds a query with a dynamically varying where clause, the .? function on the optional parameters has the effect of removing the enclosing condition when the argument is None.
Observe how following calls affect the generated SQL :
The same method using inhibitWhen would be :