Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for SQL ORDER BY clauses #50

Closed
heenenee opened this issue Sep 7, 2016 · 1 comment
Closed

support for SQL ORDER BY clauses #50

heenenee opened this issue Sep 7, 2016 · 1 comment

Comments

@heenenee
Copy link

heenenee commented Sep 7, 2016

Please add support for ORDER BY clauses. If there already is support and I'm not seeing it, please add an example of how to add an ORDER BY clause to a Entity.find query. Thanks.

@Tapac
Copy link
Contributor

Tapac commented Sep 8, 2016

There is two ways to "order by" entities:

  1. Make your find and order it in memory afterward :
    Entity.find { condition }.sortedBy { it.name }
  2. Make ordered query and wrap rows:
Entity.wrapRows(
     Entity.dependsOnTables.select { condition }.orderBy(EntityTable.name, false)
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants