Class: Cequel::Type::Uuid

Inherits:
Base
  • Object
show all
Defined in:
lib/cequel/type.rb

Overview

‘uuid` columns store type 1 and type 4 UUIDs. Cequel uses the `CassandraCQL::UUID` type to represent UUIDs in Ruby, since this is what the underlying `cassandra-cql` library expects. Other UUID formats are supported as inputs.

See Also:

Since:

  • 1.0.0

Direct Known Subclasses

Timeuuid

Instance Method Summary collapse

Methods inherited from Base

#compatible_types, #cql_aliases, #cql_name, #internal_name, #to_s

Instance Method Details

#cast(value) ⇒ Object

Since:

  • 1.0.0



382
383
384
385
386
387
388
# File 'lib/cequel/type.rb', line 382

def cast(value)
  case value
  when CassandraCQL::UUID then value
  when SimpleUUID::UUID then CassandraCQL::UUID.new(value.to_s)
  else CassandraCQL::UUID.new(value)
  end
end

#internal_namesObject

Since:

  • 1.0.0



378
379
380
# File 'lib/cequel/type.rb', line 378

def internal_names
  ['org.apache.cassandra.db.marshal.UUIDType']
end