Last active
October 1, 2023 13:00
-
-
Save jgrodziski/d1af3999c82d048f208698ae4c7ab819 to your computer and use it in GitHub Desktop.
Hugsql automatic renaming keys from "snake" to "kebab" using postgres.async and core.async channels
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def xform (map (partial transform-keys ->kebab-case-keyword))) | |
(defn result-one-snake->kebab | |
[this result options] | |
(let [return-chan (chan)] | |
(pipeline 1 return-chan xform (result-one this result options)) | |
return-chan)) | |
(defmethod hugsql.core/hugsql-result-fn :1 [sym] 'org.myapp.db.postgres/result-one-snake->kebab) | |
(defmethod hugsql.parameters/apply-hugsql-param :i [param data options] 'org.myapp.db.postgres/result-one-snake->kebab) | |
(defmethod hugsql.parameters/apply-hugsql-param :identifier [param data options] 'org.myapp.db.postgres/result-one-snake->kebab) | |
(defmethod hugsql.parameters/apply-hugsql-param :i* [param data options] 'org.myapp.db.postgres/result-one-snake->kebab) | |
(defmethod hugsql.parameters/apply-hugsql-param :identifier* [param data options] 'org.myapp.db.postgres/result-one-snake->kebab) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment