Skip to content

Commit

Permalink
Update old hydrate documentation 📄
Browse files Browse the repository at this point in the history
  • Loading branch information
camsaul committed Oct 17, 2016
1 parent b04cd54 commit c019b78
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/metabase/models/hydrate.clj
Original file line number Diff line number Diff line change
Expand Up @@ -362,22 +362,21 @@
You can hydrate several keys at one time:
(hydrate {:a (delay 1) :b (delay 2)} :a :b)
-> {:a 1 :b 2}
(hydrate {...} :a :b)
-> {:a 1, :b 2}
** Nested Hydration **
You can do recursive hydration by listing keys inside a vector:
(hydrate {:a (delay {:b (delay 1)})} [:a :b])
(hydrate {...} [:a :b])
-> {:a {:b 1}}
The first key in a vector will be hydrated normally, and any subsequent keys
will be hydrated *inside* the corresponding values for that key.
(hydrate {:a (delay {:b (delay {:c (delay 1)})
:e (delay 2)})}
(hydrate {...}
[:a [:b :c] :e])
-> {:a {:b {:c 1} :e 2}}"
[results k & ks]
Expand Down

0 comments on commit c019b78

Please sign in to comment.