              WriteRequest]
             com.amazonaws.ClientConfiguration
             com.amazonaws.auth.BasicAWSCredentials
-            com.amazonaws.services.dynamodb.AmazonDynamoDBClient))
+            com.amazonaws.services.dynamodb.AmazonDynamoDBClient
+            java.nio.ByteBuffer))
 
 ;;;; TODO Rotary PRs
 ;; * Feature/can update dynamo items (mrgordon)

      .listTables
      .getTableNames
      seq))

(defn- set-of [f s]
  (and (set? s) (every? f s)))

(defn- to-attr-value
  "Convert a value into an AttributeValue object."
  [value]
  (cond
   (string? value)        (doto (AttributeValue.) (.setS value))
   (number? value)        (doto (AttributeValue.) (.setN (str value)))
   (set-of string? value) (doto (AttributeValue.) (.setSS value))
   (set-of number? value) (doto (AttributeValue.) (.setNS (map str value)))
   (set? value)    (throw (Exception. "Set must be all numbers or all strings"))
   :else           (throw (Exception. (str "Unknown value type: " (type value))))))

(defn- item-map
  "Turn a item in DynamoDB into a Clojure map."

(def db-client (memoize db-client*))

(defn- coerce-num [x] (if (.contains x ".") (Double. x) (Long. x)))
(defn- coerce-ba  [^ByteBuffer bb] (.array bb))

(defn- get-value "Returns the value of an AttributeValue object."
  [attr-value]
  (or (.getS attr-value)
      (some->> (.getN  attr-value) coerce-num)
      (some->> (.getB  attr-value) coerce-ba)
      (some->> (.getSS attr-value) (into #{}))
      (some->> (.getNS attr-value) (map coerce-num) (into #{}))
      (some->> (.getBS attr-value) (map coerce-ba)  (into #{}))))

(defn- key-schema-element "Returns a new KeySchemaElement object."
  [{key-name :name key-type :type}]
