Method: Dynamoid::Adapter#delete
- Defined in:
- lib/dynamoid/adapter.rb
#delete(table, ids, options = {}) ⇒ Object
Delete an item from a table.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/dynamoid/adapter.rb', line 99 def delete(table, ids, = {}) range_key = [:range_key] # array of range keys that matches the ids passed in if ids.respond_to?(:each) ids = if range_key.respond_to?(:each) # turn ids into array of arrays each element being hash_key, range_key ids.each_with_index.map { |id, i| [id, range_key[i]] } else range_key ? ids.map { |id| [id, range_key] } : ids end batch_delete_item(table => ids) else delete_item(table, ids, ) end end |