Class: Cequel::Metal::Deleter
- Defined in:
- lib/cequel/metal/deleter.rb
Overview
Note:
This class should not be instantiated directly
DSL for the construction of a DELETE statement comprising multiple operations (e.g. deleting a column value, deleting an element from a list, etc.)
Instance Method Summary collapse
-
#delete_columns(*columns) ⇒ void
Delete specified columns.
-
#delete_row ⇒ void
Delete the entire row or rows matched by the data set.
-
#list_remove_at(column, *positions) ⇒ void
Remove elements from a list by position.
-
#map_remove(column, *keys) ⇒ void
Remote elements from a map by key.
Methods inherited from Writer
Constructor Details
This class inherits a constructor from Cequel::Metal::Writer
Instance Method Details
#delete_columns(*columns) ⇒ void
This method returns an undefined value.
Delete specified columns
32 33 34 |
# File 'lib/cequel/metal/deleter.rb', line 32 def delete_columns(*columns) statements.concat(columns) end |
#delete_row ⇒ void
This method returns an undefined value.
Delete the entire row or rows matched by the data set
22 23 24 |
# File 'lib/cequel/metal/deleter.rb', line 22 def delete_row @delete_row = true end |
#list_remove_at(column, *positions) ⇒ void
This method returns an undefined value.
Remove elements from a list by position
44 45 46 47 |
# File 'lib/cequel/metal/deleter.rb', line 44 def list_remove_at(column, *positions) statements .concat(positions.map { |position| "#{column}[#{position}]" }) end |
#map_remove(column, *keys) ⇒ void
This method returns an undefined value.
Remote elements from a map by key
56 57 58 59 |
# File 'lib/cequel/metal/deleter.rb', line 56 def map_remove(column, *keys) statements.concat(keys.length.times.map { "#{column}[?]" }) bind_vars.concat(keys) end |