Class: Believer::Insert
- Includes:
- Values
- Defined in:
- lib/believer/insert.rb
Constant Summary
Constants included from Values
Instance Attribute Summary collapse
-
#values ⇒ Object
Returns the value of attribute values.
Attributes inherited from Command
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
#values ⇒ Object
Returns the value of attribute values.
6 7 8 |
# File 'lib/believer/insert.rb', line 6 def values @values end |
Instance Method Details
#to_cql ⇒ Object
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 |