GraphQL
The main GraphQL module.
The GraphQL
module provides a
GraphQL implementation for Elixir.
Parse a query
Parse a GraphQL query
iex> GraphQL.parse "{ hello }"
{:ok, %{definitions: [
%{kind: :OperationDefinition, loc: %{start: 0},
operation: :query,
selectionSet: %{kind: :SelectionSet, loc: %{start: 0},
selections: [
%{kind: :Field, loc: %{start: 0}, name: "hello"}
]
}}
],
kind: :Document, loc: %{start: 0}
}}
Execute a query
Execute a GraphQL query against a given schema / datastore.
# iex> GraphQL.execute schema, "{ hello }"
# {:ok, %{hello: "world"}}
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 a query against a schema.
# iex> GraphQL.execute(schema, "{ hello }")
# {:ok, %{hello: world}}
Parse the input string into a Document AST.
iex> GraphQL.parse("{ hello }")
{:ok,
%{definitions: [
%{kind: :OperationDefinition, loc: %{start: 0},
operation: :query,
selectionSet: %{kind: :SelectionSet, loc: %{start: 0},
selections: [
%{kind: :Field, loc: %{start: 0}, name: "hello"}
]
}}
],
kind: :Document, loc: %{start: 0}
}
}