Order By
The orderBy
method seems simple but has a lot of depth depending on the type of arguments you pass in.
Calling orderBy
multiple times appends to the order list.
Order By (String)
Name | Type | Required | Default | Description |
column | any |
| The name of the column to order by. An | |
direction | string |
|
| The direction by which to order the query. Accepts |
Calling orderBy
multiple times will append to the order list.
You can also provide an Expression
.
Order By (List)
Name | Type | Required | Default | Description | |
column | any |
| The list of the columns to order by. Each column can optionally declare it's sort direction after a pipe delimiter. (e.g. `"height | desc"`). | |
direction | string |
|
| The direction by which to order the query. Accepts |
Order By (Array of Strings)
Name | Type | Required | Default | Description | |
column | any |
| The array of the columns to order by. Each column can optionally declare it's sort direction after a pipe delimiter. (e.g. `"height | desc"`). | |
direction | string |
|
| The direction by which to order the query. Accepts |
Order By (Array of Structs)
Name | Type | Required | Default | Description |
column | any |
| The array of the columns to order by. Each column can optionally declare it's sort direction using a struct. The struct should have a column key and an optional direction key. (e.g. | |
direction | string |
|
| The direction by which to order the query. Accepts |
Order By (Subquery)
Name | Type | Required | Default | Description |
column | any |
| The name of the column to order by. An | |
direction | string |
|
| Ignored when using a Function or QueryBuilder instance. |
You can order with a subquery using either a function or a QueryBuilder instance.
clearOrders
Name | Type | Required | Default | Description |
No arguments |
Clears the currently configured orders for the query. Usually used by downstream libraries like Quick.
reorder
Name | Type | Required | Default | Description |
column | any |
| The name of the column to order by. An | |
direction | string |
|
| The direction by which to order the query. Accepts |
Clears the currently configured orders for the query and sets the new orders passed in. Any valid argument to orderBy
can be passed here. Usually used by downstream libraries like Quick.
Last updated