transform with relational entities?

31 views
Skip to first unread message

Jason

unread,
May 27, 2013, 10:03:44 AM5/27/13
to Korma
I have these 2 definitions, when I do the select on users, I get the
json parsed as json automatically, when I do (select posts (with
users)) I get back the posts with users, but the users did not run
the transform. Is there a way I can have the transform occur or am I
doing something wrong?

(defentity users
(pk :id)
(table :users)
(transform (fn [{json :json :as v}]
(if json
(assoc v :json (cheshire.core/parse-string json))
v)))
(database db))

(defentity posts
(pk :id)
(table :posts)
(belongs-to users {:fk :user_id})
(database db))



Reply all
Reply to author
Forward
0 new messages