-
-
Notifications
You must be signed in to change notification settings - Fork 327
Order by kth column #966
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
Order by kth column #966
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure that 1_nth_col
must be added because when user wants to write ORDER BY 1
using sqlite_orm
then he/she will write order_by(1)
by default. It is not clear for users why order_by(1)
will not work but order_by(1_nth_col)
will so it would be better to support order_by(1)
instead
38454bf
to
c96d19e
Compare
ac35db0
to
1d4ace0
Compare
I'll review once #977 is closed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave API like order_by(2)
. Let's add an overload for order_by
for bindables or types associated with integer_printer
but let's leave API like this cause in SQL API is the same for both
ORDER BY 2
ORDER BY CASE ... END
examples/column_aliases.cpp
Outdated
// FROM marvel | ||
// ORDER BY 2 | ||
auto rows = storage.select(columns(&MarvelHero::name, as<colalias_i>(instr(&MarvelHero::abilities, "o"))), | ||
order_by(get<colalias_2>())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
order_by(2)
is more intuitive and available to implement. get<colalias_2>()
looks weird for newbies and raises questions
Alright, there's now an overload for |
struct literal_holder { | ||
using type = T; | ||
|
||
T value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better replace T
with type
here
thanks @trueqbit |
Addresses #950.