-
Notifications
You must be signed in to change notification settings - Fork 0
ORDER
Alex edited this page Jul 29, 2018
·
3 revisions
Possible structures:
-
String
,Symbol
just insert it in"ORDER BY #{structure} "
- SQL operator
-
Hash
- key - previsious possible structures.
- value - options representation
-
Symbol
-:last || :first || :asc || :desc
-
String
-'<' || '>'
or smthng else that passed in toUSING
-
Array
- with symbols inside
-
-
Array
- any possible structures
order: 'z.amount DESC' || :name
# => 'ORDER BY z.amount DESC ' || 'ORDER BY name '
order: [:name, [:_case ...], { amount: [:first, :desc] }]
# => 'ORDER BY name, CASE ..., amount DESC NULLS FIRST '