Module query_core::query_document
source · Expand description
Intermediate representation of the input document that is used by the query engine to build query ASTs and validate the incoming data.
Helps decoupling the incoming protocol layer from the query engine, i.e. allows the query engine to be agnostic to the actual protocol that is used on upper layers, as long as they translate to this simple intermediate representation.
The mapping illustrated with GraphQL (GQL):
- There can be multiple queries and/or mutations in one GQL request, usually designated by “query / {}” or “mutation”.
- Inside the queries / mutations are fields in GQL. In Prisma, every one of those designates exactly one
Operation
with aSelection
. - Operations are broadly divided into reading (query in GQL) or writing (mutation).
- The field that designates the
Operation
pretty much exactly maps to aSelection
:- It can have arguments,
- it can be aliased,
- it can have a number of nested selections (selection set in GQL).
- Arguments contain concrete values and complex subtypes that are parsed and validated by the query builders, and then used for querying data (input types in GQL).
Structs
Enums
- Represents the input values in a Document. This abstraction is mostly there to hold special kind of values such as
FieldRef
which have to be disambiguated at query-validation time.