How a symbol in a query pg-datahike runs becomes a function.
Datahike resolves the symbols of a query clause through
datahike.query.resolve/*symbol-resolver*. pg-datahike binds it to
symbol-resolver around every call into a query handler
(datahike.pg.server/make-query-handler), and never changes the process's
own resolver: an application embedding pg-datahike keeps resolving its own
queries as it did.
symbol-resolver knows the functions the translator emits
(datahike.pg.query-fns, the two secondary-index clauses, the two
text-search clauses), then Datahike's curated safe-symbol-resolver, which
includes whatever the application registered with
datahike.query.resolve/register-fn!. pg-datahike registers nothing: the
registry is also what Datahike's own server lets its clients call.
A binding reaches everything a statement does. A connection's calls run on its thread, results are realized before a call returns, Datahike's query engine evaluates on the calling thread, and the local writer carries the caller's bindings to the writer thread, where CHECK and foreign-key enforcement run.
How a symbol in a query pg-datahike runs becomes a function. Datahike resolves the symbols of a query clause through `datahike.query.resolve/*symbol-resolver*`. pg-datahike binds it to `symbol-resolver` around every call into a query handler (`datahike.pg.server/make-query-handler`), and never changes the process's own resolver: an application embedding pg-datahike keeps resolving its own queries as it did. `symbol-resolver` knows the functions the translator emits (`datahike.pg.query-fns`, the two secondary-index clauses, the two text-search clauses), then Datahike's curated `safe-symbol-resolver`, which includes whatever the application registered with `datahike.query.resolve/register-fn!`. pg-datahike registers nothing: the registry is also what Datahike's own server lets its clients call. A binding reaches everything a statement does. A connection's calls run on its thread, results are realized before a call returns, Datahike's query engine evaluates on the calling thread, and the local writer carries the caller's bindings to the writer thread, where CHECK and foreign-key enforcement run.
(emitted-fn sym)The function the translator names with sym, or nil.
The function the translator names with `sym`, or nil.
Resolve a query symbol the way pg-datahike runs its queries: the functions
it emits, then Datahike's safe-symbol-resolver. One value for the life of
the process, since Datahike keys its plan and result caches by the
resolver.
Resolve a query symbol the way pg-datahike runs its queries: the functions it emits, then Datahike's `safe-symbol-resolver`. One value for the life of the process, since Datahike keys its plan and result caches by the resolver.
(with-symbol-resolver & body)Run body with Datahike resolving query symbols through symbol-resolver.
Run `body` with Datahike resolving query symbols through `symbol-resolver`.
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 |