The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

GraphQL::Execution - Execute GraphQL queries

SYNOPSIS

  use GraphQL::Execution qw(execute);
  my $result = execute($schema, $doc, $root_value);

DESCRIPTION

Executes a GraphQL query, returns results.

METHODS

execute

  my $result = execute(
    $schema,
    $doc, # can also be AST
    $root_value,
    $context_value,
    $variable_values,
    $operation_name,
    $field_resolver,
    $promise_code,
  );
$schema

A GraphQL::Schema.

$doc

Either a GraphQL query document to be fed in to "parse" in GraphQL::Language::Parser, or a return value from that.

$root_value

A root value that can be used by field-resolvers. The default one needs a code-ref, a hash-ref or an object.

$context_value

A per-request scalar, that will be passed to field-resolvers.

$variable_values

A hash-ref, typically the decoded JSON object supplied by a client.

$operation_name

A string (or undef) that if given will be the name of one of the operations in the query.

$field_resolver

A code-ref to be used instead of the default field-resolver.

$promise_code

If you need to return a promise, supply a hash-ref matching "PromiseCode" in GraphQL::Type::Library.