def getSomethingGroupedBy(groupBy: String): Future[Seq[String]] = {
val query = someTable
.groupBy(cols => cols.column[String](groupBy)))
.map{
case (group, row) => group
}
db.run(query.result.transactionally)
}
But
if I try to use a groupBy: Seq[String], I get:
Slick does not know how to map the given types.
[error] Possible causes: T in Table[T] does not match your * projection,
[error] you use an unsupported type in a Query (e.g. scala List),
[error] or you forgot to import a driver api into scope.
[error] Required level: slick.lifted.FlatShapeLevel
[error] Source type: Seq[slick.lifted.Rep[String]]
[error] Unpacked type: T
[error] Packed type: G
[error] .groupBy(cols => groupBy.map(g => cols.column[String](g)))
[error] ^
[error] one error found
How can I group by an optional and/or arbitrary Seq of string columns that are user defined?