Module Sequel::SQL::CastMethods
In: lib/sequel_core/sql.rb

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

Methods

Public Instance methods

Cast the reciever to the given SQL type

[Source]

     # File lib/sequel_core/sql.rb, line 183
183:       def cast(sql_type)
184:         IrregularFunction.new(:cast, self, :AS, sql_type.to_s.lit)
185:       end
cast_as(sql_type)

Alias for cast

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

[Source]

     # File lib/sequel_core/sql.rb, line 190
190:       def cast_numeric(sql_type = nil)
191:         cast(sql_type || :integer).sql_number
192:       end

Cast the reciever to the given SQL type (or text 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_core/sql.rb, line 197
197:       def cast_string(sql_type = nil)
198:         cast(sql_type || :text).sql_string
199:       end

[Validate]