reviseRethinkDB 的 Clojure 客户端

联合创作 · 2023-09-30 19:30

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


示例代码:



(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))
浏览 18
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报