Skip to content

Latest commit

 

History

History
109 lines (80 loc) · 3.97 KB

datomic_differences.md

File metadata and controls

109 lines (80 loc) · 3.97 KB

Differences to Datomic Client API

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:

cljdoc

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:

  • 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.

connect

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.

cljdoc

create-database

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.

cljdoc

delete-database

Deletes a database with the configuration hash-map as argument.

database-exists?

Checks if a database exists with the configuration hash-map as argument.

db

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

transact

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.

cljdoc

with

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.