This mixin provides ordering methods ("asc", "desc") to expression.
Example
- sql.name.asc(); //=> name ASC
- sql.price.desc(); //=> price DESC
- sql.name.asc({nulls:"last"}); //=> name ASC NULLS LAST
- sql.price.desc({nulls:"first"}); //=> price DESC NULLS FIRST
- define({
Mark the receiving SQL column as sorting in an ascending fashion (generally a no-op).
ExampleArguments
- sql.name.asc(); //=> name ASC
- sql.name.asc({nulls:"last"}); //=> name ASC NULLS LAST
options to use when sorting
null
] String
: Set to "first" to use NULLS FIRST (so NULL values are ordered before other values), or "last" to use NULLS LAST (so NULL values are ordered after other values).
patio.sql.OrderedExpression
- function (options){
- return new OrderedExpression(this, false, options);
- }
Mark the receiving SQL column as sorting in a descending fashion.
ExampleArguments
- sql.price.desc(); //=> price DESC
- sql.price.desc({nulls:"first"}); //=> price DESC NULLS FIRST
options to use when sorting
null
] String
: Set to "first" to use NULLS FIRST (so NULL values are ordered before other values), or "last" to use NULLS LAST (so NULL values are ordered after other values).
patio.sql.OrderedExpression
- function (options){
- return new OrderedExpression(this, true, options);
- }