I had a similar question, using Slick 3.1.
If all possible sort columns have the same datatype, would you be able to compile a query and make it performant? I wasn't sure if your last comment about slowness applied to that scenario, and was having trouble figuring out how to take dynamic sorts, even with the same type.
For example, what if I want to sort by modified, created, or lastUsed timestamps in either asc or desc order.
Theoretically I wanted to do something like this, but I wasn't sure what typed would be used:
// What would the type of orderBy be?
private val orderedDynamically = Compiled { (orderBy: ???, offset: ConstColumn[Long], limit: ConstColumn[Long]) =>
CustomerImages.sortBy(_ => orderBy).drop(offset).take(limit)
}
// What would you pass in to specify CustomerImages.modified or CustomerImages.modified.desc?
// Would you use something like, CustomerImages.baseTableRow.modified.desc?
orderedDynamically((???, 40, 10))
Thanks,
Jon