Mechanisms for executing parsed queries against compiled schemas.


(execute-query context)

Entrypoint for execution of a query.

Expects the context to contain the schema and parsed query.

Returns a ResolverResult that will deliver the result map.

This should generally not be invoked by user code; see execute-parsed-query.


added in 0.19.0

(invoke-streamer context source-stream)

Given a parsed and prepared query (inside the context, as with execute-query), this will locate the streamer for a subscription and invoke it, passing it the context, the subscription arguments, and the source stream.


added in 0.34.0

(parsed-query->context parsed-query)

Converts a parsed query, prior to execution, into a context compatible with preview API:

Fields annotated with @skip and @include directives may be omitted if the parsed query has also been passed through prepare-with-query-variables, which normally happens just before query execution. If the query has not been prepared, then the directives are ignored.

This is used to preview the execution of the query prior to execution.


(selection context)

Returns the field selection, an object that implements the FieldSelection, SelectionSet, Arguments, and Directives protocols.


added in 0.17.0

(selections-seq context)

A width-first traversal of the selections tree, returning a lazy sequence of qualified field names. A qualified field name is a namespaced keyword, the namespace is the containing type, e.g. :User/name.

Fragments are flattened (as if always selected).


added in 0.34.0

(selections-seq2 context)

An enhancement of selections-seq that returns a map for each node:

The qualified field name
The arguments of the field (if any)
The alias for the field, if any


added in 0.17.0

(selections-tree context)

Constructs a tree of the selections below the current field.

Returns a map where the keys are qualified field names (the selections for this field). The value is a vector of maps with three optional keys; :args, :alias, and :selections. :args is the arguments that will be passed to that field’s resolver. :selections is the nested selection tree. :alias is the alias for the field (most fields do not have aliases).

A vector is returned because the selection for an outer field may, via aliases, reference the same inner field multiple times (with different arguments, aliases, and/or sub-selections).

Each key of a nested map is present only if a value is provided; for scalar fields with no arguments, the nested map will be nil.

Fragments are flattened into containing fields, as with selections-seq.


added in 0.17.0

(selects-field? context field-name)

Invoked by a field resolver to determine if a particular field is selected anywhere within the selection tree (that is, at any depth).