lib/dynamoid/adapter/local.rb
# Get many items at once from the hash.
# 
# @example Retrieve IDs 1 and 2 from the table testtable
#   Dynamoid::Adapter::Local.batch_get_item('table1' => ['1', '2'])
#
# @param [Hash] options the hash of tables and IDs to retrieve
#
# @return [Hash] a hash where keys are the table names and the values are the retrieved items
#
# @since 0.2.0
Get many items at once from the hash.
Get many items at once from the hash .
def batch_get_item(options)
        Hash.new { |h, k| h[k] = Array.new }.tap do |hash|
          options.each do |table_name, keys|
            table = data[table_name]
            if table and table[:range_key]
              Array(keys).each do |hash_key, range_key|
                hash[table_name] << get_item(table_name, hash_key, :range_key => range_key)
              end
            else
              Array(keys).each do |key|
                hash[table_name] << get_item(table_name, key)
              end
            end
          end
        end
      end
def batch_get_item ( options ) Hash . new { | h , k | h [ k ] = Array . new } . tap do | hash | options . each do | table_name , keys | table = data [ table_name ] if table and table [ :range_key ] Array ( keys ) . each do | hash_key , range_key | hash [ table_name ] << get_item ( table_name , hash_key , :range_key => range_key ) end else Array ( keys ) . each do | key | hash [ table_name ] << get_item ( table_name , key ) end end end end end
Get many items at once from the hash.
Get many items at once from the hash .
a hash where keys are the table names and the values are the retrieved items
a hash where keys are the table names and the values are the retrieved items
Hash
options
<not_specific>
<not_specific>
options the hash of tables and IDs to retrieve
options the hash of tables and IDs to retrieve
example
Retrieve IDs 1 and 2 from the table testtable Dynamoid::Adapter::Local.batch_get_item('table1' => ['1', '2'])
Retrieve IDs 1 and 2 from the table testtable Dynamoid :: Adapter :: Local . batch_get_item ( ' table1 ' = > [ ' 1 ' ' 2 ' ] )
since
None