Created
January 1, 2015 23:47
-
-
Save bbbates/c3e13f65bb37518b0865 to your computer and use it in GitHub Desktop.
Korma - entity transforms + key naming strategy = no worky
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
(use 'korma.core) | |
(use 'korma.db | |
(defdb db | |
(postgres {:naming {:keys (comp keyword clojure.string/upper-case name)}})) | |
(declare user) | |
(defentity address | |
(transform identity) | |
(fields :line1 :suburb) | |
(belongs-to user)) | |
(defentity user | |
(fields :name) | |
(has-many address)) | |
(select address (with user) (where {:id 1)) ;; => ({:ID 1 :LINE1 "Blah St" :SUBURB "Wagga Wagga" :USER_ID 1}) note: no user fields in result map | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment