QueryCompiler

grackle.QueryCompiler
See theQueryCompiler companion class
object QueryCompiler

Attributes

Companion
class
Source
compiler.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

class ComponentElaborator[F[_]] extends Phase

A compiler phase which partitions a query for execution by multiple composed mappings.

A compiler phase which partitions a query for execution by multiple composed mappings.

This phase transforms the input query by assigning subtrees to component mappings as specified by the supplied cmapping.

The mapping has Type and field name pairs as keys and mapping and join function pairs as values. When the traversal of the input query visits a Select node with type Type.field name it will replace the Select with a Component node comprising,

1. the mapping which will be responsible for evaluating the subquery. 2. A join function which will be called during interpretation with,

i) The deferred subquery. ii) the cursor at that point in evaluation.

This join function is responsible for computing the continuation query which will be evaluated by the responsible interpreter.

Because the join is provided with the cursor of the parent interpreter the subquery can be parameterised with values derived from the parent query.

Attributes

Companion
object
Source
compiler.scala
Supertypes
trait Phase
class Object
trait Matchable
class Any

Attributes

Companion
class
Source
compiler.scala
Supertypes
class Object
trait Matchable
class Any
Self type
class EffectElaborator[F[_]] extends Phase

A compiler phase which partitions a query for execution which may invoke multiple effect handlers.

A compiler phase which partitions a query for execution which may invoke multiple effect handlers.

This phase transforms the input query by assigning subtrees to effect handlers as specified by the supplied emapping.

The mapping has Type and field name pairs as keys and effect handlers as values. When the traversal of the input query visits a Select node with type Type.field name it will replace the Select with an Effect node comprising,

1. the effect handler which will be responsible for running the effect and evaluating the subquery against its result. 2. the subquery which will be evaluated by the effect handler.

Attributes

Companion
object
Source
compiler.scala
Supertypes
trait Phase
class Object
trait Matchable
class Any

Attributes

Companion
class
Source
compiler.scala
Supertypes
class Object
trait Matchable
class Any
Self type
object Elab

Attributes

Source
compiler.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Elab.type
case class ElabState(parent: Option[ElabState], schema: Schema, context: Context, vars: Vars, fragments: Map[String, UntypedFragment], query: Query, localEnv: Env, attributes: List[(String, Query)], childTransform: Query => Elab[Query])

The state managed by the elaboration monad.

The state managed by the elaboration monad.

Attributes

Source
compiler.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

A phase which elaborates GraphQL introspection queries into the query algrebra.

A phase which elaborates GraphQL introspection queries into the query algrebra.

Attributes

Companion
object
Source
compiler.scala
Supertypes
trait Phase
class Object
trait Matchable
class Any

Attributes

Companion
class
Source
compiler.scala
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Companion
trait
Source
compiler.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed trait IntrospectionLevel

Attributes

Companion
object
Source
compiler.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Disabled.type
object Full.type
object TypenameOnly.type
trait Phase

A QueryCompiler phase.

A QueryCompiler phase.

Attributes

Source
compiler.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class QuerySizeValidator(maxDepth: Int, maxWidth: Int) extends Phase

A compiler phase which estimates the size of a query and applies width and depth limits.

A compiler phase which estimates the size of a query and applies width and depth limits.

Attributes

Source
compiler.scala
Supertypes
trait Phase
class Object
trait Matchable
class Any

Attributes

Companion
trait
Source
compiler.scala
Supertypes
class Object
trait Matchable
class Any
Self type
trait SelectElaborator extends Phase

A compiler phase which translates Select nodes to be directly interpretable.

A compiler phase which translates Select nodes to be directly interpretable.

This phase,

1. types bindings according to the schema: i) untyped enums are validated and typed according to their declared type. ii) String and Int bindings are translated to ID bindings where appropriate. iii) default values are supplied for missing arguments. iv) arguments are permuted into the order declared in the schema.

2. eliminates Select arguments by delegating to a model-specific PartialFunction which is responsible for translating Select nodes into a form which is directly interpretable, for example, replacing them with a Filter or Unique node with a Predicate which is parameterized by the arguments, ie.,

UntypedSelect("character", None, List(IDBinding("id", "1000")), Nil, child) might be translated to, Select("character, None, Filter(FieldEquals("id", "1000"), child)) 3. GraphQL introspection query field arguments are elaborated.

Attributes

Companion
object
Source
compiler.scala
Supertypes
trait Phase
class Object
trait Matchable
class Any

A phase which elaborates variables, directives, fragment spreads and inline fragments.

A phase which elaborates variables, directives, fragment spreads and inline fragments.

1. Query variable values are substituted for all variable references.

2. skip and include directives are handled during this phase and the guarded subqueries are retained or removed as appropriate.

3. Fragment spread and inline fragments are expanded.

4. types narrowing coercions by resolving the target type against the schema.

5. verifies that leaves have an empty subselection set and that structured types have a non-empty subselection set.

Attributes

Source
compiler.scala
Supertypes
trait Phase
class Object
trait Matchable
class Any
Self type

Types

type Elab[T] = StateT[Result, ElabState, T]

Elaboration monad.

Elaboration monad.

Supports threading of state through the elaboration of a query. Provides, + access to the schema, context, variables and fragments of a query. + ability to transform the children of Selects to supply semantics for field arguments. + ability to add contextual data to the resulting query both to support propagation of context to the elaboration of children, and to to drive run time behaviour. + ability to add selects for additional attributes to the resulting query. + ability to test existence and properties of neighbour nodes of the node being elaborated. + ability to report errors and warnings during elaboration.

Attributes

Source
compiler.scala