Helper functions for easier construction of graphql queries. Most
importantly, provides the functions field, query and mutation (refer to
active-graphql.examples for usage).
Helper functions for easier construction of graphql queries. Most importantly, provides the functions `field`, `query` and `mutation` (refer to `active-graphql.examples` for usage).
(compile constr qs)Takes a graphql method contructor function (either query or mutation)
and returns a grapqhl document with the fields qs that can be printed via
print-document.
Takes a graphql method contructor function (either `query` or `mutation`) and returns a grapqhl document with the fields `qs` that can be printed via `print-document`.
(field the-name & args)Takes the name of a graphql query or mutation the-name and a number of
args. args can be elements of type keyword, string, inline-fragments or fields themselves.
If the-name is a vector, it's first element is the alias for the query, the
second one the 'real' name.
Takes the name of a graphql query or mutation `the-name` and a number of args. `args` can be elements of type keyword, string, inline-fragments or `field`s themselves. If `the-name` is a vector, it's first element is the alias for the query, the second one the 'real' name.
(mutation & qs)Takes an arbitrary number of field and wraps them in a mutation document.
Takes an arbitrary number of `field` and wraps them in a mutation document.
(project args)Takes a seq (list or vector) or args and converts them to
active-graphql.core/field*s. Each entry is either:
[alias field-name] (i.e. [:id :userId])active-graphql/fieldactive-graphql/inline-fragmentConverts fields recursively.
Takes a seq (list or vector) or `args` and converts them to `active-graphql.core/field*`s. Each entry is either: * a keyword or string * a vector or `[alias field-name]` (i.e. `[:id :userId]`) * a `active-graphql/field` * a `active-graphql/inline-fragment` Converts `fields` recursively.
(query & qs)Takes an arbitrary number of field and wraps them in a query document.
Takes an arbitrary number of `field` and wraps them in a query document.
(request document)request takes a graphql document and returns a stringified version ready
for sending to an endpoint.
Examples:
(request (query (field :foo :bar)))
;; => "\"query\": \"query { foo { bar }}\""
(request (query (field :foo {:obj (stringify {:name "wilhelm"})} :bar)))
;; => "\"query\": \"query { foo(obj: \\\"foo\\\":\\\"bar\\\"}\\\") { bar }\"
`request` takes a graphql `document` and returns a stringified version ready
for sending to an endpoint.
Examples:
```
(request (query (field :foo :bar)))
;; => "\"query\": \"query { foo { bar }}\""
(request (query (field :foo {:obj (stringify {:name "wilhelm"})} :bar)))
;; => "\"query\": \"query { foo(obj: \\\"foo\\\":\\\"bar\\\"}\\\") { bar }\"
```(select arg-pairs)Takes a map or seq containing pairs of keys (either keyword or string) and
values (in #{int float boolean string}) and returns a map prepared for
usage as a graphql map. The key is converted to a string, the val is wrapped
via active-graphql.builder/wrap-in-graphql-arg.
Takes a map or seq containing pairs of keys (either keyword or string) and
values (in `#{int float boolean string}`) and returns a map prepared for
usage as a graphql map. The key is converted to a string, the val is wrapped
via `active-graphql.builder/wrap-in-graphql-arg`.(subscription q)Takes a single field and wraps it in a subscription document.
Takes a single `field` and wraps it in a subscription document.
(wrap-in-graphql-arg value)Takes a value in #{int float boolean string map coll keyword} and wraps it in a
graphql value.
Takes a `value` in `#{int float boolean string map coll keyword}` and wraps it in a
graphql value.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 |