Public API, uniform over both access modes:
Entity navigation (entity/touch) is a peer-only feature; client-mode calls raise :client/peer-only.
Public API, uniform over both access modes:
- peer (embedded): (connect {:storage :memory}) / {:storage :file :path}
- client (remote): (client/connect {:host ... :port ...}) from
kala.client — pass that connection to these same
functions and every operation travels through the transactor.
Entity navigation (entity/touch) is a peer-only feature; client-mode
calls raise :client/peer-only.(as-of db t)The db value as of transaction t (a t counter or a tx entity id). All readers — q, pull, entity, datoms — work on the returned value.
The db value as of transaction t (a t counter or a tx entity id). All readers — q, pull, entity, datoms — work on the returned value.
(connect {:keys [storage path name] :or {storage :memory name "db"}})Open a peer connection to a database:
(connect {:storage :memory :name "dev"}) (connect {:storage :file :path "/var/data/mydb"}) (connect {:storage my-adapter}) ; any Storage adapter
The keyword forms name the built-in storage backends; a value satisfying the Storage protocol is wired in directly, making the storage seam exercisable through the front door. Opening existing storage rebuilds the db from the log — crash recovery is part of connect. For remote access, connect through kala.client/connect and use these same operations.
Open a peer connection to a database:
(connect {:storage :memory :name "dev"})
(connect {:storage :file :path "/var/data/mydb"})
(connect {:storage my-adapter}) ; any Storage adapter
The keyword forms name the built-in storage backends; a value satisfying
the Storage protocol is wired in directly, making the storage seam
exercisable through the front door. Opening existing storage rebuilds the
db from the log — crash recovery is part of connect. For remote access,
connect through kala.client/connect and use these same operations.(datoms db index components)Enumerate datoms from an index (:eavt :aevt :avet :vaet), narrowed by prefix components. Returned datoms carry the attribute ident as :a.
Enumerate datoms from an index (:eavt :aevt :avet :vaet), narrowed by prefix components. Returned datoms carry the attribute ident as :a.
(db conn)The current immutable db value (peer), or a marker for the transactor's current db (client).
The current immutable db value (peer), or a marker for the transactor's current db (client).
(db-storage db)The storage handle backing a db value — the plain-map read accessor.
The storage handle backing a db value — the plain-map read accessor.
(db-t db)The db value's transaction counter t — the plain-map read accessor.
The db value's transaction counter t — the plain-map read accessor.
(entid db ident)Resolve an ident keyword to its entity id; entity ids pass through.
Resolve an ident keyword to its entity id; entity ids pass through.
(entity db eid)A lazy navigable entity (peer mode only): (e :attr), (:attr e), :db/id, reverse refs via :ns/_attr. Ref attributes return entities.
A lazy navigable entity (peer mode only): (e :attr), (:attr e), :db/id, reverse refs via :ns/_attr. Ref attributes return entities.
(history db)Every assertion and retraction ever transacted, each with its added flag.
Every assertion and retraction ever transacted, each with its added flag.
(pull db pattern eid)Shape one entity into a document per the pull pattern, e.g. (pull db '[*] eid) or (pull db '[{:person/friend [:person/name]}] eid).
Shape one entity into a document per the pull pattern, e.g.
(pull db '[*] eid) or (pull db '[{:person/friend [:person/name]}] eid).(q query & inputs)Run a Datalog query against the db (and any further :in inputs):
(q '[:find ?n :in $ ?name :where [?p :person/name ?name]] (db conn) "Alice")
The query is a data form or an EDN string.
Run a Datalog query against the db (and any further :in inputs): (q '[:find ?n :in $ ?name :where [?p :person/name ?name]] (db conn) "Alice") The query is a data form or an EDN string.
(seek-datoms db index components)All datoms from the requested index position onward (no prefix filter), for paging scans (peer mode only).
All datoms from the requested index position onward (no prefix filter), for paging scans (peer mode only).
(since db t)A view of the db exposing only datoms asserted after t.
A view of the db exposing only datoms asserted after t.
(touch e)Expand an entity into a plain map, loading its component tree (peer mode only).
Expand an entity into a plain map, loading its component tree (peer mode only).
(transact conn tx-data)Apply transaction data (list-form ops and/or map-form entity maps, any mix) and return the tx report {:db-before :db-after :tx-data :tempids}.
Apply transaction data (list-form ops and/or map-form entity maps, any
mix) and return the tx report {:db-before :db-after :tx-data :tempids}.(with db tx-data)Speculative transaction against a db value: returns the report {:db-before :db-after :t :tx-data :tempids} without any storage effect.
Speculative transaction against a db value: returns the report
{:db-before :db-after :t :tx-data :tempids} without any storage effect.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 |