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 Attribute Summary
Attributes inherited from Writer
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
Methods included from Util::Forwardable
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
33 34 35 |
# File 'lib/cequel/metal/deleter.rb', line 33 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
23 24 25 |
# File 'lib/cequel/metal/deleter.rb', line 23 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
45 46 47 48 |
# File 'lib/cequel/metal/deleter.rb', line 45 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
57 58 59 60 |
# File 'lib/cequel/metal/deleter.rb', line 57 def map_remove(column, *keys) statements.concat(keys.length.times.map { "#{column}[?]" }) bind_vars.concat(keys) end |