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 in the signature you may use the following like in Datomic:
Please be aware that q returns sets instead of vectors. Only when using aggregates or :with, q returns a
vector. That is the behavior of Datascript.
The following functions from the datahike.api namespace are different from Datomic's client API:
Additionally, datahike supports most functions from datascript
in the datahike.api namespace.
These functions of Datomic are not yet implemented but considered candidates for future development:
These functions are part of Datomics' distributed implementation and are currently not part of the Datahike API:
Async support is on our roadmap as well as running distributed Datahike.
Connects to an existing database given the configuration hash-map where Datomic takes a client as argument. The specification for the configuration can be found here.
Creates a new database with the given configuration hash-map where Datomic takes a client and an
arg-map as arguments. Additional optional parameters are schema-flexibility, keep-history?
and initial-tx. Have a look at the configuration documentation for details.
Deletes a database with the configuration hash-map as argument.
Checks if a database exists with the configuration hash-map as argument.
Since the database can be just de-referenced from the connection this function is just a small wrapper for Datomic compliance.
(db conn)
equivalent to:
@conn
Returns a hash map different from Datomics' as a report. The :tx-meta is not part
of Datomics' transaction report but apart from that the same keys are present. The
values are different records though.
A local transaction function can access allocated tempids with
[:db.fn/call-with-tempids f arg ...]. Datahike calls
(f tx-db tempids arg ...) and applies the returned transaction data.
The immutable tempids map holds the bindings available when the
function runs. Read it again on each invocation because a retry can
assign different entity IDs.
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. It works quite the same as Datomics' with but does
not need a with-db function to work.
A Datomic peer calls any function or Java method on its classpath from a
query; Datomic Cloud requires custom functions to be deployed as ions and
listed under :allow. Datahike embedded behaves like the peer. The Datahike
server resolves only a curated pure subset of clojure.core, clojure.string
and functions registered with datahike.query.resolve/register-fn! or
register-ns!, the counterpart of the ion allow-list; see
http-routes.md.
Can you improve this documentation? These fine people already did:
Christian Weilbach, Konrad Kühne, Judith, Timo Kramer & JCEdit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |