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
417 418 419 420 421 422 423 424 425 426 427 |
# File 'lib/cequel/type.rb', line 417 def cast(value) if value.is_a? Cassandra::Uuid then value elsif defined?(SimpleUUID::UUID) && value.is_a?(SimpleUUID::UUID) Cassandra::Uuid.new(value.to_i) elsif value.is_a?(::Integer) || value.is_a?(::String) Cassandra::Uuid.new(value) else fail ArgumentError, "Don't know how to cast #{value.inspect} to a UUID" end end |
#internal_names ⇒ Object
413 414 415 |
# File 'lib/cequel/type.rb', line 413 def internal_names ['org.apache.cassandra.db.marshal.UUIDType'] end |