Datomic:无法评估来自REPL的d /交易

问题描述 投票:0回答:1

我是Datomic内部人员的新手。但是我无法从编辑器中调用d /事务。

我启动了对等服务器和事务处理程序。

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个回答
0
投票

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

-d pensine,datomic:mem://pensine

并使用]连接>

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

在此设置中,您不需要事务处理程序。

希望有帮助,我尚未进行更全面的设置。

© www.soinside.com 2019 - 2024. All rights reserved.