GraphQL

The main GraphQL module.

The GraphQL module provides a GraphQL implementation for Elixir.

Parse a query

Parse a GraphQL query

GraphQL.parse "{ hello }"
#=> [kind: :Document, loc: [start: 0],
#  definitions: [[kind: :OperationDefinition, loc: [start: 0], operation: :query,
#    selectionSet: [kind: :SelectionSet, loc: [start: 0],
#     selections: [[kind: :Field, loc: [start: 0], name: 'hello']]]]]]

Execute a query

Execute a GraphQL query against a given schema / datastore.

GraphQL.execute schema, "{ hello }"

Summary

Execute a query against a schema

Parse the input string into a Document AST

Tokenize the input string into a stream of tokens

Functions

execute(schema, query)

Execute a query against a schema.

Examples

GraphQL.execute(schema, "{ hello }")
#=> [data: [hello: world]]
parse(input_string)

Parse the input string into a Document AST.

Examples

GraphQL.parse("{ hello }")
#=> [kind: :Document, loc: [start: 1],
#  definitions: [[kind: :OperationDefinition, loc: [start: 1], operation: :query,
#    selectionSet: [kind: :SelectionSet, loc: [start: 1],
#     selections: [[kind: :Field, loc: [start: 1], name: 'hello']]]]]]
tokenize(input_string)

Tokenize the input string into a stream of tokens.

Examples

GraphQL.tokenize("{ hello }")
#=> [{ :"{", 1 }, { :name, 1, 'hello' }, { :"}", 1 }]