     (db-client creds)
     (scan-request table options))))
 
+(defn- set-hash-condition
+  "Create a map of specifying the hash-key condition for query"
+  [hash-key]
+  (utils/fmap #(doto (Condition.)
+                 (.setComparisonOperator "EQ")
+                 (.setAttributeValueList [(clj-val->db-val %)]))
+              hash-key))
+
+;; (defn- set-range-condition
+;;   "Add the range key condition to a QueryRequest object"
+;;   [query-request operator & [range-key range-end]]
+;;   (let [attribute-list (->> [range-key range-end] (remove nil?) (map clj-val->db-val))]
+;;     (.setRangeKeyCondition query-request
+;;                            (doto (Condition.)
+;;                              (.withComparisonOperator operator)
+;;                              (.withAttributeValueList attribute-list)))))
+
 (defn- set-range-condition
   "Add the range key condition to a QueryRequest object"
-  [query-request operator & [range-key range-end]]
-  (let [attribute-list (->> [range-key range-end] (remove nil?) (map clj-val->db-val))]
-    (.setRangeKeyCondition query-request
-                           (doto (Condition.)
-                             (.withComparisonOperator operator)
-                             (.withAttributeValueList attribute-list)))))
+  [range-key operator & [range-value range-end]]
+  (let [attribute-list (->> [range-value range-end] (filter identity) (map clj-val->db-val))]
+    {range-key (doto (Condition.)
+                 (.setComparisonOperator operator)
+                 (.setAttributeValueList attribute-list))}))
 
 (defn- normalize-operator
   "Maps Clojure operators to DynamoDB operators"

(defprotocol AsMap (as-map [x]))

(extend-protocol AsMap
  KeySchemaElement
  (as-map [element]
    {:name (.getAttributeName element)
     :type (-> (.getAttributeType element)
               (str/lower-case)
               (keyword))})

  KeySchema
  (as-map [schema]
    (merge
     (when-let [e (.getHashKeyElement schema)]  {:hash-key  (as-map e)})
     (when-let [e (.getRangeKeyElement schema)] {:range-key (as-map e)})))

  ProvisionedThroughputDescription
  (as-map [throughput]

     :unprocessed-keys (utils/fmap as-map (into {} (.getUnprocessedKeys result)))})

  GetItemResult (as-map [result] (db-map->clj-map (.getItem result)))

  nil (as-map [_] nil))

