Although datahike supports a part of Datomic's
API, some
behavior is different using the different functions. Datahike supports part of the datomic.client.api
:
Without differences you may use the following like in Datomic:
The following functions from the datahike.api
namespace are different from Datomic's client API:
Additionally, datahike supports also almost all functions from
datascript in the datahike.core
namespace.
Connects to an existing database given a URL
or host configuration hash-map. The schema for
the URL
and hash-map can be found here.
(connect "datahike:mem://datomic-diff")
Creates a new database given a URL
or configuration hash-map with additional
optional parameters for schema-on-read
and temporal-index
capabilities. Have
a look at the configuration documentation for details.
(create-database "datahike:mem://datomic-diff" :schema-on-read true
:temporal-index false)
The signature is different. Index can be selected: :eavt
, :aevt
, :avet
and
components to be matched using entity, attribute and values. Find more examples
and documentation either in the examples project or in the code documentation.
(datoms @conn :eavt :name)
Since the database can be just de-referenced from the connection this function is just a small wrapper for Datomic compliance.
(db conn)
The deletion supports only URIs at the moment.
Returns a different hash map as a report. Have a look at the clojure docs for more examples.
Applies transactions to an immutable database value and returns a new database snapshot. It does not change the mutable database inside the connection unlike transact.
Can you improve this documentation? These fine people already did:
Konrad Kühne & JCEdit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close