RethinkDB 的 Clojure 客戶端:revise
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))
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!