lib/dynamoid/adapter.rb
# Read one or many keys from the selected table. This method intelligently calls batch_get or get on the underlying adapter depending on
# whether ids is a range or a single key: additionally, if partitioning is enabled, it batch_gets all keys in the partition space
# automatically. Finally, if a range key is present, it will also interpolate that into the ids so that the batch get will acquire the
# correct record.
#
# @param [String] table the name of the table to write the object to
# @param [Array] ids to fetch, can also be a string of just one id
# @param [Number] range_key the range key of the record
#
# @since 0.2.0
Read one or many keys from the selected table. This method intelligently calls batch_get or get on the underlying adapter depending on
whether ids is a range or a single key: additionally, if partitioning is enabled, it batch_gets all keys in the partition space
automatically. Finally, if a range key is present, it will also interpolate that into the ids so that the batch get will acquire the
correct record.
Read one or many keys from the selected table . This method intelligently calls batch_get or get on the underlying adapter depending on whether ids is a range or a single key : additionally if partitioning is enabled it batch_gets all keys in the partition space automatically . Finally if a range key is present it will also interpolate that into the ids so that the batch get will acquire the correct record .
def read(table, ids, options = {})
      range_key = options[:range_key]
      if ids.respond_to?(:each)
        ids = ids.collect{|id| range_key ? [id, range_key] : id}
        if Dynamoid::Config.partitioning?
          results = batch_get_item(table => id_with_partitions(ids))
          {table => result_for_partition(results[table])}
        else
          batch_get_item(table => ids)
        end
      else
        if Dynamoid::Config.partitioning?
          ids = range_key ? [[ids, range_key]] : ids
          results = batch_get_item(table => id_with_partitions(ids))
          result_for_partition(results[table]).first
        else
          get_item(table, ids, options)
        end
      end
    end
def read ( table , ids , options = { } ) range_key = options [ :range_key ] if ids . respond_to? ( :each ) ids = ids . collect { | id | range_key ? [ id , range_key ] : id } if Dynamoid :: Config . partitioning? results = batch_get_item ( table => id_with_partitions ( ids ) ) { table => result_for_partition ( results [ table ] ) } else batch_get_item ( table => ids ) end else if Dynamoid :: Config . partitioning? ids = range_key ? [ [ ids , range_key ] ] : ids results = batch_get_item ( table => id_with_partitions ( ids ) ) result_for_partition ( results [ table ] ) . first else get_item ( table , ids , options ) end end end
Read one or many keys from the selected table.
Read one or many keys from the selected table .
table
<not_specific>
ids
<not_specific>
options
<not_specific>
<not_specific>
range_key the range key of the record
range_key the range key of the record
since
None