You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, I can specify how jdbc should transform a clojure value into a sql value using the ISQLValue and ISQLParameter protocols. If I try this and use korma, inserting values works fine...but updating ignores these protocols, for whatever reason.
For example, a minimal (almost)-working example:
;; store UUIDs as strings
(extend-protocol jdbc/ISQLValue
java.util.UUID
(sql-value [uuid]
(str uuid)))
(defnnew-uuid [] (java.util.UUID/randomUUID))
;; dangerous, but just to illustrate my point;; throws an error, cannot set varchar to type uuid
(korma/update my-table (korma/set-fields {:my-id (new-uuid)}))
;; ...but this works exactly as expected
(korma/insert my-table (korma/values {:my-id (new-uuid)}))
The text was updated successfully, but these errors were encountered:
So, I can specify how
jdbc
should transform a clojure value into a sql value using theISQLValue
andISQLParameter
protocols. If I try this and use korma, inserting values works fine...but updating ignores these protocols, for whatever reason.For example, a minimal (almost)-working example:
The text was updated successfully, but these errors were encountered: