Fixes NPE in <-pgobject
This commit is contained in:
parent
005ec2ac83
commit
d6d0edb7a6
1 changed files with 3 additions and 5 deletions
|
|
@ -417,14 +417,12 @@ containing JSON:
|
||||||
(.setValue (->json x)))))
|
(.setValue (->json x)))))
|
||||||
|
|
||||||
(defn <-pgobject
|
(defn <-pgobject
|
||||||
"Transform PGobject containing `json` or `jsonb` value to Clojure
|
"Transform PGobject containing `json` or `jsonb` value to Clojure data."
|
||||||
data."
|
[^PGobject v]
|
||||||
[^org.postgresql.util.PGobject v]
|
|
||||||
(let [type (.getType v)
|
(let [type (.getType v)
|
||||||
value (.getValue v)]
|
value (.getValue v)]
|
||||||
(if (#{"jsonb" "json"} type)
|
(if (#{"jsonb" "json"} type)
|
||||||
(when value
|
(some-> value <-json (with-meta {:pgtype type}))
|
||||||
(with-meta (<-json value) {:pgtype type}))
|
|
||||||
value)))
|
value)))
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue