Liking cljdoc? Tell your friends :D

fmnoise.qb


->bindingclj

(->binding v & [uniq?])
source

=>cljmacro

(=> & conditions)

Quotes symbols starting from ? and _ symbol in given condition form. (let [attr :payment/id id 100] (=> [?payment attr ?id] id)) ;; [[?payment :payment/id ?id] 100]

Quotes symbols starting from ? and `_` symbol in given condition form.
(let [attr :payment/id
      id 100]
  (=> [?payment attr ?id] id))
;; [[?payment :payment/id ?id] 100]
sourceraw docstring

add-inputclj

(add-input q binding source & [expand-coll?])

Adds query input. Last optional agrument turns automatic expanding of collection source into collection binding

Adds query input. Last optional agrument turns automatic expanding of collection source into collection binding
sourceraw docstring

data->queryclj

(data->query conditions)
(data->query src conditions)
source

excludeclj

(exclude q binding values & [input-name])
source

findclj

(find bindings)
(find q bindings & [override?])

Adds bindings to query :find

Adds bindings to query `:find`
sourceraw docstring

find-collclj

(find-coll binding)
(find-coll q binding)

Adds collection binding to query :find

Adds collection binding to query `:find`
sourceraw docstring

find-scalarclj

(find-scalar binding)
(find-scalar q binding)

Adds scalar binding to query :find

Adds scalar binding to query `:find`
sourceraw docstring

inclj

(in q src)
(in q binding source & inputs)

Adds query input. If binding for input is not specified, its added as $ as first argument. If source is set?, the corresponding collection binding is added

Adds query input. If binding for input is not specified, its added as `$` as first argument.
If source is `set?`, the corresponding collection binding is added
sourceraw docstring

map->queryclj

(map->query conditions)
(map->query src conditions)

Transforms key-value map into query map. By default entity is bound as ?e but this can be redefined with :find meta supplied with map. Another supported meta attributes are :as for defining query keys and :first which will return scalar value

(map->query {:user/id 1 :user/type :admin}) ;; => {:query {:find [[?e ...]], :where [[?e :user/id ?user-id] [?e :user/type ?user-type]], :in [?user-id ?user-type]}, :args [1 :admin]}

(map->query ^{:find '?user} {:user/id 1}) ;; => {:query {:find [[?user ...]], :where [[?user :user/id ?user-id]], :in [?user-id]}, :args [1]}

(map->query ^{:find '?user :as :user} {:user/id 1}) ;; => {:query {:find [?user], :keys [:user], :where [[?user :user/id ?user-id]], :in [?user-id]}, :args [1]}

Transforms key-value map into query map. By default entity is bound as ?e but this can be redefined with `:find` meta supplied with map.
Another supported meta attributes are `:as` for defining query keys and `:first` which will return scalar value

(map->query {:user/id 1 :user/type :admin})
;; => {:query {:find [[?e ...]], :where [[?e :user/id ?user-id] [?e :user/type ?user-type]], :in [?user-id ?user-type]}, :args [1 :admin]}

(map->query ^{:find '?user} {:user/id 1})
;; => {:query {:find [[?user ...]], :where [[?user :user/id ?user-id]], :in [?user-id]}, :args [1]}

(map->query ^{:find '?user :as :user} {:user/id 1})
;; => {:query {:find [?user], :keys [:user], :where [[?user :user/id ?user-id]], :in [?user-id]}, :args [1]}
sourceraw docstring

or-joinclj

(or-join q conditions & [values])
source

vector->queryclj

(vector->query conditions)
(vector->query src conditions)

Transforms vector with attributes and values into query map. By default entity is bound as ?e but this can be redefined with :find meta supplied with vector Another supported meta attributes are :as for defining query keys and :first which will return scalar value.

(vector->query [:user/id 1 :user/type :admin]) ;; => {:query {:find [[?e ...]], :where [[?e :user/id ?user-id] [?e :user/type ?user-type]], :in [?user-id ?user-type]}, :args [1 :admin]}

(vector->query ^{:find '?user} [:user/id 1]) ;; => {:query {:find [[?user ...]], :where [[?user :user/id ?user-id]], :in [?user-id]}, :args [1]}

(vector->query ^{:find '?user :as :user} [:user/id 1]) ;; => {:query {:find [?user], :keys [:user], :where [[?user :user/id ?user-id]], :in [?user-id]}, :args [1]}

Transforms vector with attributes and values into query map. By default entity is bound as ?e but this can be redefined with `:find` meta supplied with vector
Another supported meta attributes are `:as` for defining query keys and `:first` which will return scalar value.

(vector->query [:user/id 1 :user/type :admin])
;; => {:query {:find [[?e ...]], :where [[?e :user/id ?user-id] [?e :user/type ?user-type]], :in [?user-id ?user-type]}, :args [1 :admin]}

(vector->query ^{:find '?user} [:user/id 1])
;; => {:query {:find [[?user ...]], :where [[?user :user/id ?user-id]], :in [?user-id]}, :args [1]}

(vector->query ^{:find '?user :as :user} [:user/id 1])
;; => {:query {:find [?user], :keys [:user], :where [[?user :user/id ?user-id]], :in [?user-id]}, :args [1]}
sourceraw docstring

whereclj

(where q condition)
(where q condition value)

Adds condition to query. Accepts optional value. If value is nil, condition is transformed into (not [...]). If value is set?, the corresponding collection binding is addded

Adds condition to query. Accepts optional value.
If value is nil, condition is transformed into (not [...]).
If value is `set?`, the corresponding collection binding is addded
sourceraw docstring

where*clj

(where* q conditions)

Adds multiple conditions/values from supplied collection to query using where. If condition needs to have supplied value, it should be wrapped in vector eg (where* q [[?e :order/id] [['?e :order/customer '?c] customer]

Adds multiple conditions/values from supplied collection to query using `where`.
If condition needs to have supplied value, it should be wrapped in vector eg
(where* q
  [[?e :order/id]
   [['?e :order/customer '?c] customer]
sourceraw docstring

where->clj

(where-> q & conditions)

Adds multiple conditions/values to query using where. If condition needs to have supplied value, it should be wrapped in vector eg (where-> q ['?e :order/id] [['?e :order/customer '?c] customer]

Adds multiple conditions/values to query using `where`.
If condition needs to have supplied value, it should be wrapped in vector eg
(where-> q
  ['?e :order/id]
  [['?e :order/customer '?c] customer]
sourceraw docstring

where-letcljmacro

(where-let q bindings & conditions)
source

where-notclj

(where-not q condition)
(where-not q condition value)

Adds not condition to query. Accepts optional value. If value is set, it's used as function to filter out conditions

Adds `not` condition to query. Accepts optional value.
If value is set, it's used as function to filter out conditions
sourceraw docstring

where-not*clj

(where-not* q conditions)

Adds multiple conditions/values from supplied collection to query using where-not. If condition needs to have supplied value, it should be wrapped in vector eg (where-not* q [[?e :order/cancelled] ['?e :order/status '?s] status])

Adds multiple conditions/values from supplied collection to query using `where-not`.
If condition needs to have supplied value, it should be wrapped in vector eg
(where-not* q
  [[?e :order/cancelled]
   ['?e :order/status '?s] status])
sourceraw docstring

where?clj

(where? q cond-vals)
(where? q condition value)

Adds condition to query only if supplied value is not nil. Accepts either query condition and value or map/list/vector of conditions and values eg: (where? q {'[?e :order/id ?id] id '[?e :order/customer ?c] customer} (where? q ['[?e :order/id ?id] id '[?e :order/customer ?c] customer]

Adds condition to query only if supplied value is not nil.
Accepts either query condition and value or map/list/vector of conditions and values eg:
(where? q {'[?e :order/id ?id] id
           '[?e :order/customer ?c] customer}
(where? q ['[?e :order/id ?id] id
           '[?e :order/customer ?c] customer]
sourceraw docstring

withclj

(with q & bindings)

Adds with part to query

Adds `with` part to query
sourceraw docstring

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

× close