Sha256: 9dfe0ad224161cfa23d3f5f4aeb81222b0285b1c0e9c3a3d2f9b290af64ae72b

Contents?: true

Size: 1.93 KB

Versions: 79

Compression:

Stored size: 1.93 KB

Contents

module Fog
  module AWS
    class DynamoDB
      class Real

        # Query DynamoDB items
        #
        # ==== Parameters
        # * 'table_name'<~String> - name of table to query
        # * 'hash_key'<~Hash> - hash key to query
        # * options<~Hash>:
        #   * 'AttributesToGet'<~Array> - Array of attributes to get for each item, defaults to all
        #   * 'ConsistentRead'<~Boolean> - Whether to wait for consistency, defaults to false
        #   * 'Count'<~Boolean> - If true, returns only a count of such items rather than items themselves, defaults to false
        #   * 'Limit'<~Integer> - limit of total items to return
        #   * 'RangeKeyCondition'<~Hash>: value to compare against range key
        #     * 'AttributeValueList'<~Hash>: one or more values to compare against
        #     * 'ComparisonOperator'<~String>: comparison operator to use with attribute value list, in %w{BETWEEN BEGINS_WITH EQ LE LT GE GT}
        #   * 'ScanIndexForward'<~Boolean>: Whether to scan from start or end of index, defaults to start
        #   * 'ExclusiveStartKey'<~Hash>: Key to start listing from, can be taken from LastEvaluatedKey in response
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'ConsumedCapacityUnits'<~Integer> - number of capacity units used for query
        #     * 'Count'<~Integer> - number of items in response
        #     * 'Items'<~Array> - array of items returned
        #     * 'LastEvaluatedKey'<~Hash> - last key scanned, can be passed to ExclusiveStartKey for pagination
        def query(table_name, hash_key, options = {})
          body = {
            'TableName'     => table_name,
            'HashKeyValue'  => hash_key
          }.merge(options)

          request(
            :body     => Fog::JSON.encode(body),
            :headers  => {'x-amz-target' => 'DynamoDB_20111205.Query'}
          )
        end

      end
    end
  end
end

Version data entries

79 entries across 79 versions & 12 rubygems

Version Path
fog-maestrodev-1.18.0.20131209090811 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.18.0.20131205181604 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.18.0.20131127194823 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.18.0.20131126183714 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.18.0.20131126122111 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.18.0.20131125111730 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.18.0.20131125083406 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.18.0.20131123105121 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.18.0.20131122203507 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.18.0.20131121075022 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.18.0.20131118164830 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.18.0.20131115184302 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.18.0.20131114200144 lib/fog/aws/requests/dynamodb/query.rb
gapinc-fog-1.12.1.2.1 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.18.0.20131112185232 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.18.0.20131111203459 lib/fog/aws/requests/dynamodb/query.rb
fog-1.18.0 lib/fog/aws/requests/dynamodb/query.rb
fog-1.17.0 lib/fog/aws/requests/dynamodb/query.rb
fog-1.16.0 lib/fog/aws/requests/dynamodb/query.rb