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