【问题标题】:Datomic: Can't evaluate d/transaction from REPLDatomic:无法评估来自 REPL 的 d/transaction
【发布时间】:2019-12-21 21:49:53
【问题描述】:

我是 Datomic on-prem 的新手。但我无法通过我的编辑调用 d/transact。

我启动了我的对等服务器和我的交易者。

bin/run -m datomic.peer-server -h localhost -p 8998 -a myaccesskey,mysecret -d pensine,datomic:dev://localhost:4334/pensine
bin/transactor config/samples/dev-transactor-template.properties 

我已经在我的缓冲区中写了这个


(def cfg {:server-type :peer-server
          :access-key "myaccesskey"
          :secret "mysecret"
          :endpoint "localhost:8998"})

(def client (d/client cfg))


(def conn (d/connect client {:db-name "datomic:dev://localhost:4334/pensine"}))

// Loaded everything above in the REPL then tried to evaluate the expression below.

(d/transact conn {:tx-data [{:db/ident :red}]}) // this throw the error below
@(d/transact conn {:tx-data [{:db/ident :red}]}) // this throw the error below

REPL 输出:

Execution error (IllegalArgumentException) at datomic.client.api.protocols/fn$G (protocols.clj:72).
No implementation of method: :transact of protocol: #'datomic.client.api.protocols/Connection found for class: clojure.lang.Var$Unbound

【问题讨论】:

    标签: clojure datomic


    【解决方案1】:

    在我的开发内存设置中,我使用参数启动对等服务器

    -d pensine,datomic:mem://pensine
    

    并使用连接

    (def conn (d/connect client {:db-name "pensine"}))
    

    在此设置中,您不需要交易者。

    希望对您有所帮助,我还没有进行更全面的设置。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-25
      • 1970-01-01
      • 1970-01-01
      • 2011-07-29
      • 1970-01-01
      • 2017-04-26
      • 1970-01-01
      • 2013-12-04
      相关资源
      最近更新 更多