Class: Cequel::Type::Uuid
Overview
‘uuid` columns store type 1 and type 4 UUIDs. New UUID instances can be created using the Cequel.uuid method, and a value can be checked to see if it is a UUID recognized by Cequel using the Cequel.uuid? method.
Direct Known Subclasses
Instance Method Summary collapse
Methods inherited from Base
#compatible_types, #cql_aliases, #cql_name, #internal_name, #to_s
Instance Method Details
#cast(value) ⇒ Object
409 410 411 412 413 414 415 416 417 418 419 |
# File 'lib/cequel/type.rb', line 409 def cast(value) if value.is_a? Cql::Uuid then value elsif defined?(SimpleUUID::UUID) && value.is_a?(SimpleUUID::UUID) Cql::Uuid.new(value.to_i) elsif value.is_a?(::Integer) || value.is_a?(::String) Cql::Uuid.new(value) else fail ArgumentError, "Don't know how to cast #{value.inspect} to a UUID" end end |
#internal_names ⇒ Object
405 406 407 |
# File 'lib/cequel/type.rb', line 405 def internal_names ['org.apache.cassandra.db.marshal.UUIDType'] end |