Module | Sequel::SQL::CastMethods
In: | lib/sequel/sql.rb

Holds methods that are used to cast objects to differen SQL types.

### Methods

cast cast_numeric cast_string

### Public Instance methods

cast(sql_type)

Cast the reciever to the given SQL type. You can specify a ruby class as a type, and it is handled similarly to using a database independent type in the schema methods.

[Source]

         # File lib/sequel/sql.rb, line 202
    202:       def cast(sql_type)
    203:         Cast.new(self, sql_type)
    204:       end

cast_numeric(sql_type = nil)

Cast the reciever to the given SQL type (or the database‘s default integer type if none given), and return the result as a NumericExpression.

[Source]

         # File lib/sequel/sql.rb, line 208
    208:       def cast_numeric(sql_type = nil)
    209:         cast(sql_type || Integer).sql_number
    210:       end

cast_string(sql_type = nil)

Cast the reciever to the given SQL type (or the database‘s default string type if none given), and return the result as a StringExpression, so you can use + directly on the result for SQL string concatenation.

[Source]

         # File lib/sequel/sql.rb, line 215
    215:       def cast_string(sql_type = nil)
    216:         cast(sql_type || String).sql_string
    217:       end

[Validate]