Liking cljdoc? Tell your friends :D

workflo.macros.query


+query-fragment-registry+clj/s

source

bind-query-parametersclj/s

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

conformclj/s

(conform query)
source

conform-and-parseclj/s

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

map-destructuring-keysclj/s

(map-destructuring-keys query)

Generates keys for destructuring a map of query results.

Generates keys for destructuring a map of query results.
sourceraw docstring

parseclj/s

(parse query)
source

parse-subqueryclj/smultimethod

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

query-typeclj/s

(query-type query)
source

register-query-fragment!clj/s

(register-query-fragment! name def)
source

registered-query-fragmentsclj/s

(registered-query-fragments)
source

reset-registered-query-fragments!clj/s

(reset-registered-query-fragments!)
source

resolve-query-fragmentclj/s

(resolve-query-fragment name)
source

unregister-query-fragment!clj/s

(unregister-query-fragment! name)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close