About Slick concatenated orders by

35 views
Skip to first unread message

Antonio reKiem

unread,
Feb 24, 2017, 1:08:30 AM2/24/17
to Slick / ScalaQuery
According to the slick documentation in this part:
Be aware that a single ORDER BY with multiple columns is not equivalent to multiple .sortBy calls but to a single .sortBy call passing a tuple
But what happend if i want to make a dynamic order by (variable number of colums)? , since i can not create dynamic sized tuples.
I already asked this in stack overflow, but using the answer that I received, I am still generating chaining calls to sortBy. The query is created fine, but then why the documentation says is not equivalent?

Richard Dallaway

unread,
Feb 24, 2017, 4:25:04 AM2/24/17
to scala...@googlegroups.com
It'll be good to improve this documentation. Perhaps we can add:

Specifically, multiple .sortBy calls produce an ORDER BY where the last sortBy call appears first in the ORDER BY expression.

....if we can make that guarantee.  

I've not looked into how this is generated to see if that's true.  If it is, it's a quick PR to https://github.com/slick/slick/blob/master/slick/src/sphinx/sql-to-slick.rst

Richard

--

---
You received this message because you are subscribed to the Google Groups "Slick / ScalaQuery" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalaquery+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scalaquery/034aca9e-6271-48c8-9827-0864fe2c25c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Antonio reKiem

unread,
Feb 24, 2017, 12:48:27 PM2/24/17
to Slick / ScalaQuery
Thanks for the quick response, I will do some more test to be sure the order is always reversed, then, do you sugguest that I raise an issue to improve this part of the documentation?

Richard Dallaway

unread,
Feb 27, 2017, 6:15:50 AM2/27/17
to Slick / ScalaQuery
Yes - sounds good.  Or a PR with improved wording.

Thanks
Richard


Reply all
Reply to author
Forward
0 new messages