Represents a column/expression to order the result set by.

Extends Static Properties
PropertyTypeDefault ValueDescription
INVERT_NULLSObject {first:"last", last:"first"}

Hash that contains the inversions for "first" and "last".

Instance Properties
PropertyTypeDefault ValueDescription
descendingBooleantrue

READ ONLY true if decending, false otherwise.

expression

READ ONLY the expression to order.

nullsStringnull

if value is "first" the null values will be first, if "last" then null values will be last

Constructor

Defined sql.js Source
  1. function (expression,descending,opts){
  2. descending = isBoolean(descending) ? descending : true;
  3. opts = opts || {};
  4. this.__expression = expression;
  5. this.__descending = descending;
  6. var nulls = isString(opts) ? opts : opts.nulls;
  7. this.__nulls = isString(nulls) ? nulls.toLowerCase() : null;
  8. }

asc Function Public


Defined sql.js

Returns Source
  1. function (){
  2. return new OrderedExpression(this.__expression, false, {nulls: this.__nulls});
  3. }

desc Function Public


Defined sql.js

Returns Source
  1. function (){
  2. return new OrderedExpression(this.__expression, true, {nulls: this.__nulls});
  3. }

invert Function Public


Defined sql.js

*

Returns Source
  1. function (){
  2. return new OrderedExpression(this.__expression, !this.__descending, {nulls: this._static.INVERT_NULLS[this.__nulls] || this.__nulls});
  3. }

toString Function Public


Defined sql.js

Converts the patio.sql.OrderedExpression to a string.

Arguments Returns Source
  1. function (ds){
  2. !Dataset && (Dataset = require("./dataset"));
  3. ds = ds || new Dataset();
  4. return ds.orderedExpressionSql(this);
  5. }

Documentation generated using coddoc.