Skip to content

Instantly share code, notes, and snippets.

@bbbates
Created January 1, 2015 23:47
Show Gist options
  • Save bbbates/c3e13f65bb37518b0865 to your computer and use it in GitHub Desktop.
Save bbbates/c3e13f65bb37518b0865 to your computer and use it in GitHub Desktop.
Korma - entity transforms + key naming strategy = no worky
(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