(bind-query-parameters query params)
Takes a parsed query and a map of named parameters and their values. Binds the unbound parameters in the query (that is, those where the value is either a symbol beginning with a ? or a vector of such symbols) to values of the corresponding parameters in the parameter map and returns the result.
As an example, the :db/id parameter in the query
[{:name user :type :join :join-target [{:name name :type :property}] :parameters {:db/id ?foo :user/friend [?bar ?baz]}}]
would be bound to the value 10 if the parameter map was {:foo 10 :bar {:baz :ruux}} and the :user/friend parameter would be bound to the value :ruux.
Takes a parsed query and a map of named parameters and their values. Binds the unbound parameters in the query (that is, those where the value is either a symbol beginning with a ? or a vector of such symbols) to values of the corresponding parameters in the parameter map and returns the result. As an example, the :db/id parameter in the query [{:name user :type :join :join-target [{:name name :type :property}] :parameters {:db/id ?foo :user/friend [?bar ?baz]}}] would be bound to the value 10 if the parameter map was {:foo 10 :bar {:baz :ruux}} and the :user/friend parameter would be bound to the value :ruux.
(conform-and-parse query)
Conforms and parses a query expression like
[user [name :as nm email {friends User}] [current-user _]]
into a flat vector of parsed properties with the following structure:
[{:name user/name :type :property :alias nm}
{:name user/email :type :property}
{:name user/friends :type :join :join-target User}
{:name current-user :type :link :link-id _}].
From this it is trivial to generate queries for arbitrary frameworks (e.g. Om Next) as well as keys for destructuring the results.
Conforms and parses a query expression like [user [name :as nm email {friends User}] [current-user _]] into a flat vector of parsed properties with the following structure: [{:name user/name :type :property :alias nm} {:name user/email :type :property} {:name user/friends :type :join :join-target User} {:name current-user :type :link :link-id _}]. From this it is trivial to generate queries for arbitrary frameworks (e.g. Om Next) as well as keys for destructuring the results.
(map-destructuring-keys query)
Generates keys for destructuring a map of query results.
Generates keys for destructuring a map of query results.
Takes a subquery and returns a vector of parsed properties, each in one of the following forms:
{:name user/name :type :property :alias user-name}
{:name user/email :type :property}
{:name user/friends :type :join
:join-source {name user/friends :type :property}
:join-target User}
{:name user/friends :type :join
:join-source {:name user/friends :type :property}
:join-target [{:name user/name :type :property}]}
{:name current-user :type :link :link-id _}.
Each of these may in addition contain an optional :parameters key with a {symbol ?variable}-style map and an :alias key with a symbol to use when destructuring instead of the original name.
Takes a subquery and returns a vector of parsed properties, each in one of the following forms: {:name user/name :type :property :alias user-name} {:name user/email :type :property} {:name user/friends :type :join :join-source {name user/friends :type :property} :join-target User} {:name user/friends :type :join :join-source {:name user/friends :type :property} :join-target [{:name user/name :type :property}]} {:name current-user :type :link :link-id _}. Each of these may in addition contain an optional :parameters key with a {symbol ?variable}-style map and an :alias key with a symbol to use when destructuring instead of the original name.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close