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-1.22.0 lib/fog/aws/requests/dynamodb/query.rb
fog-1.21.0 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/aws/requests/dynamodb/query.rb
fog-1.20.0 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/aws/requests/dynamodb/query.rb
fog-1.19.0 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/aws/requests/dynamodb/query.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/aws/requests/dynamodb/query.rb