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



88
89
90
# File 'lib/cassandra_model/data_inquirer.rb', line 88

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

#to(type) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/cassandra_model/data_inquirer.rb', line 73

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))
  end
end