This mixin provides ordering methods ("asc", "desc") to expression.
Examplesql.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).
Examplesql.name.asc(); //=> name ASC sql.name.asc({nulls:"last"}); //=> name ASC NULLS LASTArguments
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.
Examplesql.price.desc(); //=> price DESC sql.price.desc({nulls:"first"}); //=> price DESC NULLS FIRSTArguments
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); }