Clojure的数据库访问库:oj
jopen
10年前
oj是一个用于Clojure应用的访问数据库的库。
(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)))
特性
- 给你生成SQL的标准接口
- 强制类型检查和验证查询
- Sensible defaults
- Concise and powerful API
- Encourages reusable components
Anti-features
- Doesn't require you to write SQL
- Doesn't create its own domain-specific language (there are no macros)
- Doesn't surprise you