Created
April 22, 2019 03:03
-
-
Save souenzzo/a0f9624e7dd20589ca9ad8905334b7cc to your computer and use it in GitHub Desktop.
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
(defn username-by-id | |
{::pc/kind pc/resolver | |
::pc/input #{:app.user/id} | |
::pc/output [:app.user/username]} | |
[{::keys [db]} {:app.user/keys [id]}] | |
{:app.user/username (-> (j/query db ["SELECT username FROM app_user WHERE id = ?" | |
id]) | |
first | |
:username)}) | |
(let [var->resolve (fn [x] | |
(let [sym (symbol x) | |
{::pc/keys [kind] :as options} (meta x)] | |
(kind sym options @x)))] | |
(var->resolve #'username-by-id)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment