lib/dynamoid/adapter/aws_sdk.rb
# Query the DynamoDB table. This employs DynamoDB's indexes so is generally faster than scanning, but is
# only really useful for range queries, since it can only find by one hash key at once. Only provide
# one range key to the hash.
#
# @param [String] table_name the name of the table
# @param [Hash] opts the options to query the table with
# @option opts [String] :hash_value the value of the hash key to find
# @option opts [Range] :range_value find the range key within this range
# @option opts [Number] :range_greater_than find range keys greater than this
# @option opts [Number] :range_less_than find range keys less than this
# @option opts [Number] :range_gte find range keys greater than or equal to this
# @option opts [Number] :range_lte find range keys less than or equal to this
#
# @return [Array] an array of all matching items
#
# @since 0.2.0
Query the DynamoDB table. This employs DynamoDB's indexes so is generally faster than scanning, but is
only really useful for range queries, since it can only find by one hash key at once. Only provide
one range key to the hash.
Query the DynamoDB table . This employs DynamoDB ' s indexes so is generally faster than scanning but is only really useful for range queries since it can only find by one hash key at once . Only provide one range key to the hash .
def query(table_name, opts = {})
        table = get_table(table_name)
        consistent_opts = { :consistent_read => opts[:consistent_read] || false }
        if table.composite_key?
          results = []
          table.items.query(opts).each {|data| results << data.attributes.to_h(consistent_opts).symbolize_keys!}
          results
        else
          get_item(table_name, opts[:hash_value])
        end
      end
def query ( table_name , opts = { } ) table = get_table ( table_name ) consistent_opts = { :consistent_read => opts [ :consistent_read ] || false } if table . composite_key? results = [ ] table . items . query ( opts ) . each { | data | results << data . attributes . to_h ( consistent_opts ) . symbolize_keys! } results else get_item ( table_name , opts [ :hash_value ] ) end end
Query the DynamoDB table.
Query the DynamoDB table .
an array of all matching items
an array of all matching items
Array
table_name
<not_specific>
opts
:range_lte find range keys less than or equal to this
: range_lte find range keys less than or equal to this
<not_specific>
opts the options to query the table with
opts the options to query the table with
since
None