Clojure oj 是一个新的 Clojure 库,用来与数据库进行通讯,灵感来自于 Ring.
示例代码:
(require [oj.core :as oj]) [oj.modifiers :as db]) (defn find-by-username [username] (-> (db/query :users) (db/select [:id :username :email :created_at]) (db/where {:username username}) (oj/exec db-config) (first))) (find-by-username "taylorlapeyre") ; => {:id 1 :username "taylorlapeyre"}