Class: Cequel::Type::Timestamp
Overview
‘timestamp` columns store timestamps. Timestamps do not include time zone data, and all input times are cast to UTC before being stored.
Instance Method Summary collapse
Methods inherited from Base
#compatible_types, #cql_aliases, #cql_name, #internal_name, #to_s
Instance Method Details
#cast(value) ⇒ Object
358 359 360 361 362 363 364 |
# File 'lib/cequel/type.rb', line 358 def cast(value) if value.is_a?(::String) then Time.parse(value) elsif value.respond_to?(:to_time) then value.to_time elsif value.is_a?(Numeric) then Time.at(value) else Time.parse(value.to_s) end.utc end |
#internal_names ⇒ Object
353 354 355 356 |
# File 'lib/cequel/type.rb', line 353 def internal_names ['org.apache.cassandra.db.marshal.DateType', 'org.apache.cassandra.db.marshal.TimestampType'] end |