class Cequel::Type::Uuid

`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.

@see cassandra.apache.org/doc/latest/cql/types.html

CQL3 data type documentation

Public Instance Methods

cast(value) click to toggle source
# File lib/cequel/type.rb, line 436
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() click to toggle source
# File lib/cequel/type.rb, line 432
def internal_names
  ['org.apache.cassandra.db.marshal.UUIDType']
end