tools: fix thaw arg destructuring & opt merging
This commit is contained in:
parent
a7e9f98d44
commit
7e7975910a
2 changed files with 4 additions and 4 deletions
|
|
@ -37,8 +37,8 @@
|
||||||
"Like `nippy/thaw` but takes options from *thaw-opts* binding, and wraps
|
"Like `nippy/thaw` but takes options from *thaw-opts* binding, and wraps
|
||||||
encrypted bytes for easy identification when no password has been provided
|
encrypted bytes for easy identification when no password has been provided
|
||||||
for decryption."
|
for decryption."
|
||||||
[ba & {:keys [default-opts]}]
|
[ba & [{:keys [default-opts]}]]
|
||||||
(let [result (nippy/thaw ba (merge (or *thaw-opts* default-opts)
|
(let [result (nippy/thaw ba (merge default-opts *thaw-opts*
|
||||||
{:taoensso.nippy/tools-thaw? true}))]
|
{:taoensso.nippy/tools-thaw? true}))]
|
||||||
(if (= result :taoensso.nippy/need-password)
|
(if (= result :taoensso.nippy/need-password)
|
||||||
(EncryptedFrozen. ba)
|
(EncryptedFrozen. ba)
|
||||||
|
|
@ -46,4 +46,4 @@
|
||||||
|
|
||||||
(comment (thaw (nippy/freeze "c" {:password [:cached "p"]}))
|
(comment (thaw (nippy/freeze "c" {:password [:cached "p"]}))
|
||||||
(with-thaw-opts {:password [:cached "p"]}
|
(with-thaw-opts {:password [:cached "p"]}
|
||||||
(thaw (nippy/freeze "c" {:password [:cached "p"]}))))
|
(thaw (nippy/freeze "c" {:password [:cached "p"]}))))
|
||||||
|
|
|
||||||
|
|
@ -92,4 +92,4 @@
|
||||||
|
|
||||||
(comment (String. (ba-concat (.getBytes "foo") (.getBytes "bar")))
|
(comment (String. (ba-concat (.getBytes "foo") (.getBytes "bar")))
|
||||||
(let [[x y] (ba-split (.getBytes "foobar") 5)]
|
(let [[x y] (ba-split (.getBytes "foobar") 5)]
|
||||||
[(String. x) (String. y)]))
|
[(String. x) (String. y)]))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue