I have a table with a tuple (2 different columns) as my primary key. I am trying to make a function findByPrimaryKeys(pks: Vector[(Long, Long)]) that returns a query for all the rows with a primary key in the set pks. However, it seems there is no way to do this, I can do
table.filter(t => t.id1.inSet(pks.map(_._1)) && t => t.id2.inSet(pk2.map(_._2)))
However, this is not exactly correct, as it could return something that has a matching id2 but not id1.
Is there way to combine Reps?
Yes, it's possible to combine
Repvalue, there's an implicit conversion from(Rep[Long], Rep[Long])toRep[(Long, Long)]. But that doesn't help in this case becauseinSetis added through an implicit conversion, and that conversion requires an implicitBaseTypedType[(Long, Long)]to be available, which it isn't.The only way I know to solve this problem is to use a fold: