I\'m trying to create a typesafe dynamic DSL for a Slick table but not sure how to achieve this.
Users can post filters to the server by sending filters in form/json
I was looking for the same thing, and came across this question - the accepted answer was a very heavy inspiration to what I eventually landed on. Details are here.
The only comments I'd make about the accepted answer - TablePredicate[Item, T <: Table[Item]] can just be simplified to TablePredicate[T <: Table[_]] because Item is never used (at least in the sample). LiteralColumn(1) === LiteralColumn(1) can also just be LiteralColumn(Some(true)) (makes the generated queries slightly less awkward) - I'm pretty sure with a little more work, these could be eliminated entirely.