Skip to content

Commit 749aead

Browse files
committed
Sync housekeeping
1 parent 88e7699 commit 749aead

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

src/taoensso/faraday.clj

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@
9292
java.nio.ByteBuffer))
9393

9494
(if (vector? taoensso.encore/encore-version)
95-
(enc/assert-min-encore-version [2 29 1])
96-
(enc/assert-min-encore-version 2.29))
95+
(enc/assert-min-encore-version [2 67 2])
96+
(enc/assert-min-encore-version 2.67))
9797

9898
;;;; Connections
9999

@@ -243,7 +243,7 @@
243243
^AttributeValue [x]
244244
(cond
245245
(enc/stringy? x)
246-
(let [^String s (enc/fq-name x)]
246+
(let [^String s (enc/as-qname x)]
247247
(if (.isEmpty s)
248248
(throw (Exception. "Invalid DynamoDB value: \"\""))
249249
(doto (AttributeValue.) (.setS s))))
@@ -254,15 +254,19 @@
254254
(freeze? x) (doto (AttributeValue.) (.setB (nt-freeze x)))
255255

256256
(vector? x) (doto (AttributeValue.) (.setL (mapv clj-val->db-val x)))
257-
(map? x) (doto (AttributeValue.) (.setM (enc/map-kvs
258-
(fn [k _] (name k))
259-
(fn [_ v] (clj-val->db-val v))
260-
x)))
257+
(map? x)
258+
(doto (AttributeValue.)
259+
(.setM
260+
(reduce-kv
261+
(fn [acc k v] (assoc acc (name k) (clj-val->db-val v)))
262+
{}
263+
x)))
264+
261265
(set? x)
262266
(if (empty? x)
263267
(throw (Exception. "Invalid DynamoDB value: empty set"))
264268
(cond
265-
(enc/revery? enc/stringy? x) (doto (AttributeValue.) (.setSS (mapv enc/fq-name x)))
269+
(enc/revery? enc/stringy? x) (doto (AttributeValue.) (.setSS (mapv enc/as-qname x)))
266270
(enc/revery? ddb-num? x) (doto (AttributeValue.) (.setNS (mapv str x)))
267271
(enc/revery? freeze? x) (doto (AttributeValue.) (.setBS (mapv nt-freeze x)))
268272
:else (throw (Exception. (str "Invalid DynamoDB value: set of invalid type"

test/taoensso/faraday/tests/main.clj

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -661,13 +661,7 @@
661661
)
662662

663663

664-
(let
665-
;; Dissoc'ing :bytes, :throwable, :ex-info, and :exception because Object#equals()
666-
;; is reference-based and not structural. `expect` falls back to Java equality,
667-
;; and so will fail when presented with different Java objects that don't themselves
668-
;; implement #equals() - such as arrays and Exceptions - despite having identical data.
669-
[data ;; nippy/stress-data-comparable ; Awaiting Nippy v2.6
670-
(dissoc nippy/stress-data :bytes :throwable :exception :ex-info)]
664+
(let [data nippy/stress-data-comparable]
671665
(expect ; Serialization
672666
{:id 10 :nippy-data data}
673667
(do (far/put-item *client-opts* ttable {:id 10 :nippy-data (far/freeze data)})

0 commit comments

Comments
 (0)