revise - RethinkDB 的 Clojure 客户端


EPL
跨平台
Java

软件简介

revise 是 RethinkDB
Clojure 客户端开发包。特点是:异步、无锁、高效以及易用。

示例代码:

(require '[bitemyapp.revise.connection :refer [connect close]])
(require '[bitemyapp.revise.query :as r])
(require '[bitemyapp.revise.core :refer [run]])

;; connect returns the connection agent
(let [local-conn  (connect) ;; defaults to localhost
      ;; pass in connection options map to specify beyond the defaults
      remote-conn (connect {:host "99.99.99.1"
                            :port 28015
                            :auth-key ""})
      ;; running a query against a connection returns a promise, the API
      ;; and underlying implementation are asynchronous.
      response (-> (r/db "test") (r/table-create-db "authors") (run local-conn))]
  ;; dereference the promise to block on it.
  (println @response)
  ;; We are done using the connection
  (close local-conn))