Class: Believer::Insert

Inherits:
Command show all
Includes:
Values
Defined in:
lib/believer/insert.rb

Constant Summary

Constants included from Values

Values::TIMESTAMP_FORMAT

Instance Attribute Summary collapse

Attributes inherited from Command

#record_class

Instance Method Summary collapse

Methods included from Values

#convert_to_boolean, #convert_to_float, #convert_to_integer, #convert_to_time, #to_cql_literal

Methods inherited from Command

#clone, #connection, #execute, #initialize, #query_attributes

Constructor Details

This class inherits a constructor from Believer::Command

Instance Attribute Details

#valuesObject

Returns the value of attribute values.



6
7
8
# File 'lib/believer/insert.rb', line 6

def values
  @values
end

Instance Method Details

#to_cqlObject



12
13
14
15
# File 'lib/believer/insert.rb', line 12

def to_cql
  attrs = @values.keys
  "INSERT INTO #{@record_class.table_name} (#{attrs.join(', ')}) VALUES (#{attrs.map {|a| to_cql_literal(@values[a]) }.join(', ')})"
end