metabase / toucan

A classy high-level Clojure library for defining application models and retrieving them from a DB
Eclipse Public License 1.0
570 stars 49 forks source link

Allow extending protocols right from defmodel #9

Closed plexus closed 7 years ago

plexus commented 7 years ago

The current way of specifying hydration keys is rather unwieldy, so I came up with this

(defmodel Video :videos
  models/IModel
  (hydration-keys [_]
    [:video :preview_video]))

I have a working patch (see this gist). Happy to submit it, just wanted to check first if this is something you'd be interested in.

camsaul commented 7 years ago

@plexus, sure. There's no reason not to support something like this

camsaul commented 7 years ago

If you submitted a PR do you think you could update the dox as well to include both ways of doing things?

plexus commented 7 years ago

ok, I can do that.