Skip to content

Instantly share code, notes, and snippets.

@jgrodziski
Last active January 16, 2018 17:53
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Hugsql automatic renaming keys from "snake" to "kebab" using postgres.async and core.async channels
(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