Defines case methods

Constructor

Defined sql.js Source
  1. define({

cast Function Public


Defined sql.js

Cast the reciever to the given SQL type.

Example
  1. sql.a.cast("integer") //=> CAST(a AS integer)
  2. sql.a.cast(String) //=> CAST(a AS varchar(255))
Arguments Returns Source
  1. function (type){
  2. return new Cast(this, type);
  3. }

castNumeric Function Public


Defined sql.js

Cast the reciever to the given SQL type (or the database's default Number type if none given.

Example
  1. sql.a.castNumeric() //=> CAST(a AS integer)
  2. sql.a.castNumeric("double") //=> CAST(a AS double precision)
Arguments Returns Source
  1. function (type){
  2. return this.cast(type || "integer").sqlNumber;
  3. }

castString Function Public


Defined sql.js

Cast the reciever to the given SQL type (or the database's default String type if none given), and return the result as a patio.sql.StringExpression.

Example
  1. sql.a.castString() //=> CAST(a AS varchar(255))
  2. sql.a.castString("text") //=> CAST(a AS text)
Arguments Returns Source
  1. function (type){
  2. return this.cast(type || String).sqlString;
  3. }

Documentation generated using coddoc.