Sha256: 30b8274d2aebccc9e17882c809de617c74afc00514cfea41f983218a8fada805

Contents?: true

Size: 1.93 KB

Versions: 9

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     => MultiJson.encode(body),
            :headers  => {'x-amz-target' => 'DynamoDB_20111205.Query'}
          )
        end

      end
    end
  end
end

Version data entries

9 entries across 9 versions & 5 rubygems

Version Path
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/dynamodb/query.rb
michiels-fog-1.3.1 lib/fog/aws/requests/dynamodb/query.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/lib/fog/aws/requests/dynamodb/query.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/dynamodb/query.rb
fog-1.3.1 lib/fog/aws/requests/dynamodb/query.rb
fog-1.3.0 lib/fog/aws/requests/dynamodb/query.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/lib/fog/aws/requests/dynamodb/query.rb
fog-1.2.0 lib/fog/aws/requests/dynamodb/query.rb
ktheory-fog-1.1.2 lib/fog/aws/requests/dynamodb/query.rb