revise是RethinkDB的Clojure客户端开发包。特点是:异步、无锁、高效以及易用。
示例代码:
(require'[bitemyapp.revise.connection:refer[connectclose]])(require'[bitemyapp.revise.query:asr])(require'[bitemyapp.revise.core:refer[run]]);;connectreturnstheconnectionagent(let[local-conn(connect);;defaultstolocalhost;;passinconnectionoptionsmaptospecifybeyondthedefaultsremote-conn(connect{:host"99.99.99.1":port28015:auth-key""});;runningaqueryagainstaconnectionreturnsapromise,theAPI;;andunderlyingimplementationareasynchronous.response(->(r/db"test")(r/table-create-db"authors")(runlocal-conn))];;dereferencethepromisetoblockonit.(println@response);;Wearedoneusingtheconnection(closelocal-conn))
评论