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 configuration hash-map or URI (deprecated). The specification for the configuration can be found here.
(create-database {:store {:backend :file :path "/tmp/datomic-diff"}})
Creates a new database given configuration hash-map or an URI (deprecated) with additional
optional parameters for schema-flexibility
and keep-history?
capabilities. Have
a look at the configuration documentation for details.
(create-database {:store {:backend :mem :id "datomic-diff"} :keep-history? false :schema-flexibility :read})
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