Class: CassandraModel::DataInquirer::ColumnType

Inherits:
Struct
  • Object
show all
Defined in:
lib/cassandra_model/data_inquirer.rb

Instance Method Summary collapse

Instance Method Details

#retype_to(type) ⇒ Object



92
93
94
# File 'lib/cassandra_model/data_inquirer.rb', line 92

def retype_to(type)
  inquirer.partition_key[column] = type
end

#to(type) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/cassandra_model/data_inquirer.rb', line 75

def to(type)
  retype_to(type)

  case type
    when :int then
      default_to(0)
    when :double then
      default_to(0.0)
    when :timestamp then
      default_to(Time.at(0))
    when :uuid then
      default_to(Cassandra::Uuid.new(0))
    when :text then
      default_to('')
  end
end