What's the current best way to go for dynamic sorting. I am using following query
val q2 = q1.sortBy[scala.slick.lifted.Column[Option[String]]](queryParams.sortTerm match {
case "itemSKU" => _._2
case "price" => _._3
case _ => _._1
})
But since I need to specify type (in red) the returning column type can not be dynamic. Looks like I am doing something wrong here.
Pradeep Kumar Mishra
unread,
Nov 14, 2012, 4:13:12 AM11/14/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to scala...@googlegroups.com
FYI getting following error if I do not specify any type in sortBy
No implicit view available from scala.slick.lifted.Column[_ >: Option[String] with Double with String] => scala.slick.lifted.Ordered.
Ryan Bair
unread,
Nov 14, 2012, 9:05:50 AM11/14/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to scala...@googlegroups.com
Columns have methods desc and asc on them which return an Ordering. Rather than just returning _._2 from the case you could return _._2.desc instead. You should not need the type parameter if you do that.
--
Pradeep Kumar Mishra
unread,
Nov 14, 2012, 7:33:25 PM11/14/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message