Liking cljdoc? Tell your friends :D

kala.api

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.

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.
raw docstring

as-ofclj

(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.
raw docstring

connectclj

(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.
raw docstring

datomsclj

(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.
raw docstring

dbclj

(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).
raw docstring

db-storageclj

(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.
raw docstring

db-tclj

(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.
raw docstring

entidclj

(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.
raw docstring

entityclj

(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.
raw docstring

historyclj

(history db)

Every assertion and retraction ever transacted, each with its added flag.

Every assertion and retraction ever transacted, each with its added flag.
raw docstring

pullclj

(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).
raw docstring

qclj

(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.
raw docstring

seek-datomsclj

(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).
raw docstring

sinceclj

(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.
raw docstring

touchclj

(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).
raw docstring

transactclj

(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}.
raw docstring

withclj

(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.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close