UUIDs
donbonifacio opened this issue · 4 comments
donbonifacio commented
Hello,
I'm having some problems with a column of type UUID. If I use plain jdbc it states that the type is java.util.UUID
, but running a query on postgres.async I get:
"No method in multimethod 'from-pg-value' for dispatch value: UUID"
I tried to implement it:
(defmethod from-pg-value java.util.UUID [oid value]
(java.util.UUID/fromString value))
But I still get the same error, it doesn't reach my converter. Can you provide some help on this?
alaisi commented
Hi,
Here is an example of adding support for UUIDs:
(defmethod from-pg-value com.github.pgasync.impl.Oid/UUID [oid value]
(java.util.UUID/fromString (String. ^bytes value "UTF-8")))
(extend-protocol IPgParameter
java.util.UUID
(to-pg-value [uuid]
(.getBytes (.toString uuid) "UTF-8")))
But UUIDs support should really be included in the library. Thanks for the bug report.
donbonifacio commented
Thanks @alaisi
What about the JSON type, shouldn't it be on the lib by default?
alaisi commented
UUID is now supported out of the box, JSON/JSONB requires adding dependency to cheshire and reading a new ns, see README.
donbonifacio commented
👍