Datahike adapter primitives: the handful of places where datahike spells something differently from DataScript. Nothing above this namespace mentions datoms, seek bounds, or how an attribute is represented in a datom.
This namespace is JVM-only, as is the rest of the module: datahike's ClojureScript API is asynchronous, and the backend SPI is synchronous.
Datahike adapter primitives: the handful of places where datahike spells something differently from DataScript. Nothing above this namespace mentions datoms, seek bounds, or how an attribute is represented in a datom. This namespace is JVM-only, as is the rest of the module: datahike's ClojureScript API is asynchronous, and the backend SPI is synchronous.
(attr-repr db attr)attr in the representation this db uses for it: the keyword itself, or its
numeric ref under :attribute-refs?. Resolved once per operation rather than
per datom — an entity lookup per datom would dominate an index scan.
`attr` in the representation this db uses for it: the keyword itself, or its numeric ref under `:attribute-refs?`. Resolved once per operation rather than per datom — an entity lookup per datom would dominate an index scan.
(attribute-refs? db)Whether this db represents attributes as numeric refs (Datomic's representation) rather than as keywords. A creation-time choice, so it is constant for the life of the database. Use Datahike's database protocol rather than record-field lookup so temporal wrappers delegate to their origin database.
Whether this db represents attributes as numeric refs (Datomic's representation) rather than as keywords. A creation-time choice, so it is constant for the life of the database. Use Datahike's database protocol rather than record-field lookup so temporal wrappers delegate to their origin database.
(avet-datoms db attr)(avet-datoms db attr v)Datoms of attr, optionally restricted to an exact value.
Datoms of `attr`, optionally restricted to an exact value.
(avet-tuple-prefix db attr arity prefix)(avet-tuple-prefix db attr arity prefix cursor-tail direction)Datoms across endpoint entities whose tuple value starts with prefix.
Current direct databases seek natively in either direction. Temporal/filter wrappers use their exact visible datoms and sort only that historical fallback result; current hot-path pagination never materializes the prefix.
Datoms across endpoint entities whose tuple value starts with `prefix`. Current direct databases seek natively in either direction. Temporal/filter wrappers use their exact visible datoms and sort only that historical fallback result; current hot-path pagination never materializes the prefix.
(checked-global-relationship-datoms db attr prefix cursor-eid direction)(checked-global-relationship-datoms db
attr
prefix
cursor-eid
direction
include-qualifier?)(checked-relationship-datoms db entity attr prefix cursor-eid direction)(checked-relationship-datoms db
entity
attr
prefix
cursor-eid
direction
include-qualifier?)(db-config db)The configuration of db through Datahike's database protocol, so
temporal and filter wrappers (AsOfDB carries only its origin and time
point as fields) report their origin's store, writer, history and
attribute representation instead of nil.
The configuration of `db` through Datahike's database protocol, so temporal and filter wrappers (`AsOfDB` carries only its origin and time point as fields) report their origin's store, writer, history and attribute representation instead of nil.
(direct-db? db)Whether db is a concrete Datahike DB rather than a temporal/filter wrapper.
Concrete and retained-commit DB records carry their config as a field.
Wrappers delegate IDB/-config but deliberately do not expose that field.
Public because physical kernel selection is basis-dependent: only a direct DB can honor a seek bound, so density-bounded batch kernels must not be selected for temporal or filter wrappers.
Whether `db` is a concrete Datahike DB rather than a temporal/filter wrapper. Concrete and retained-commit DB records carry their config as a field. Wrappers delegate `IDB/-config` but deliberately do not expose that field. Public because physical kernel selection is basis-dependent: only a direct DB can honor a seek bound, so density-bounded batch kernels must not be selected for temporal or filter wrappers.
(direct-writer? db)True when transactions against db's connection run in this process
(Datahike's default {:writer {:backend :self}}). Only a direct writer
can execute transaction functions: a remote writer receives serialized
tx-data, which cannot carry a function value.
True when transactions against `db`'s connection run in this process
(Datahike's default `{:writer {:backend :self}}`). Only a direct writer
can execute transaction functions: a remote writer receives serialized
tx-data, which cannot carry a function value.(eavt-datoms db entity attr)(eavt-datoms db entity attr v)Datoms on entity for attr, optionally restricted to an exact value.
Datahike resolves the attribute keyword in both attribute representations.
Datoms on `entity` for `attr`, optionally restricted to an exact value. Datahike resolves the attribute keyword in both attribute representations.
(eavt-tuple-prefix db entity attr arity prefix)(eavt-tuple-prefix db entity attr arity prefix lower-tail)(eavt-tuple-prefix db entity attr arity prefix cursor-tail direction)Datoms on entity whose arity-tuple value starts with prefix.
A full-length lower bound positions the scan at the requested tuple segment. The entity and attribute guards prevent a missing prefix from running into a different relationship attribute on the same endpoint. Current and retained-commit values use that seek. Temporal/filter wrappers use exact EAVT datoms plus an endpoint-local prefix filter because Datahike 0.8.1759 can skip a historically visible tuple after a later retraction.
Datoms on `entity` whose `arity`-tuple value starts with `prefix`. A full-length lower bound positions the scan at the requested tuple segment. The entity and attribute guards prevent a missing prefix from running into a different relationship attribute on the same endpoint. Current and retained-commit values use that seek. Temporal/filter wrappers use exact EAVT datoms plus an endpoint-local prefix filter because Datahike 0.8.1759 can skip a historically visible tuple after a later retraction.
(entid db eid-or-ref)entid as DataScript and Datomic define it: a number passes through
unchanged (an unallocated id is deliberately NOT rejected), an ident or
lookup ref resolves to its eid, and an unresolvable one is nil.
Datahike has no public entid, but d/entity returns nil rather than
throwing for an unresolvable lookup ref, which is exactly the contract eacl
reads. Anything else throws, as in DataScript — a silently-nil id means a
permission check that denies for the wrong reason.
`entid` as DataScript and Datomic define it: a number passes through unchanged (an unallocated id is deliberately NOT rejected), an ident or lookup ref resolves to its eid, and an unresolvable one is nil. Datahike has no public `entid`, but `d/entity` returns nil rather than throwing for an unresolvable lookup ref, which is exactly the contract eacl reads. Anything else throws, as in DataScript — a silently-nil id means a permission check that denies for the wrong reason.
(entity-data database eid)(entity-exists? db eid)Whether eid has any datom. entid passes unallocated numeric ids through
unchanged, so presence has to be checked separately.
Whether `eid` has any datom. `entid` passes unallocated numeric ids through unchanged, so presence has to be checked separately.
(entity-facts database eid)(global-relationship-identity-datoms db attr value)(relationship-identity-datoms db entity attr value)Guarded first-four identity access, including retained temporal values.
Guarded first-four identity access, including retained temporal values.
(seek-tuple-prefix db attr arity prefix)Datoms of composite-tuple attribute attr (of arity components) whose
value begins with prefix.
Datahike orders vectors by length before contents, so pad the seek key to the
tuple's full arity. The attribute guard is load-bearing: seek-datoms
continues into the next attribute when the requested prefix has no match.
Datahike carries an AsOfDB temporal context into seek-datoms, but
0.8.1759 can position a full-tuple temporal seek after a historically visible
tuple that was retracted later. Wrapper values therefore use exact AVET
datoms plus a schema-bounded prefix filter.
Datoms of composite-tuple attribute `attr` (of `arity` components) whose value begins with `prefix`. Datahike orders vectors by length before contents, so pad the seek key to the tuple's full arity. The attribute guard is load-bearing: `seek-datoms` continues into the next attribute when the requested prefix has no match. Datahike carries an `AsOfDB` temporal context into `seek-datoms`, but 0.8.1759 can position a full-tuple temporal seek after a historically visible tuple that was retracted later. Wrapper values therefore use exact AVET datoms plus a schema-bounded prefix filter.
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 |