Skip to content

Instantly share code, notes, and snippets.

Created October 9, 2019 23:19
What would you like to do?
Clojure account registration
(declare insert-account! send-welcome-email!)
(defn register-account!
(when-let [account (insert-account! account-info)]
(send-welcome-email! account)))
(defn- insert-account!
(let [account (select-keys account-info [:name :email :phone :password])]
(jdbc/insert! pgsql-config :accounts account {:result-set-fn first})))
(defn- send-welcome-email!
[{:keys [email]}]
(str "Sending welcome email to " email))
(defn registration-req-handler
(register-account! (request :body)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment