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:
- connect
- create-database
- database-exists?
- db-with
- delete-database
- entity
- entity-db
- filter
- is-filtered
- load-entities
- pull-many
- release
- seek-datoms
- tempid
- with
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:
- tx-range
- index-pull
- with-db
These functions are part of Datomics' distributed implementation and are currently not part of the Datahike API:
- client
- administer-system
- db-stats
- list-databases
- sync
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.
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.