mirror of
https://github.com/penpot/penpot.git
synced 2025-05-13 15:06:39 +02:00
✨ Make nil safe some decode helpers on db ns
This commit is contained in:
parent
ce99ca0aa8
commit
c027de2592
1 changed files with 14 additions and 12 deletions
|
@ -420,21 +420,23 @@
|
||||||
|
|
||||||
(defn decode-json-pgobject
|
(defn decode-json-pgobject
|
||||||
[^PGobject o]
|
[^PGobject o]
|
||||||
(let [typ (.getType o)
|
(when o
|
||||||
val (.getValue o)]
|
(let [typ (.getType o)
|
||||||
(if (or (= typ "json")
|
val (.getValue o)]
|
||||||
(= typ "jsonb"))
|
(if (or (= typ "json")
|
||||||
(json/read val)
|
(= typ "jsonb"))
|
||||||
val)))
|
(json/read val)
|
||||||
|
val))))
|
||||||
|
|
||||||
(defn decode-transit-pgobject
|
(defn decode-transit-pgobject
|
||||||
[^PGobject o]
|
[^PGobject o]
|
||||||
(let [typ (.getType o)
|
(when o
|
||||||
val (.getValue o)]
|
(let [typ (.getType o)
|
||||||
(if (or (= typ "json")
|
val (.getValue o)]
|
||||||
(= typ "jsonb"))
|
(if (or (= typ "json")
|
||||||
(t/decode-str val)
|
(= typ "jsonb"))
|
||||||
val)))
|
(t/decode-str val)
|
||||||
|
val))))
|
||||||
|
|
||||||
(defn inet
|
(defn inet
|
||||||
[ip-addr]
|
[ip-addr]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue