View Source GraphQLDocument.Operation (GraphQLDocument v0.2.0)

Link to this section Summary

Types

Options that can be passed along with the operation.

Functions

Generates GraphQL syntax from a nested Elixir keyword list.

Link to this section Types

@type operation_type() :: :query | :mutation | :subscription

See: http://spec.graphql.org/October2021/#OperationType

@type option() ::
  {:variables, [GraphQLDocument.Variable.definition()]}
  | {:fragments, [GraphQLDocument.Fragment.definition()]}
  | {:directives, [GraphQLDocument.Directive.t()]}

Options that can be passed along with the operation.

Link to this section Functions

Link to this function

render(operation_type \\ :query, selections, opts \\ [])

View Source

Generates GraphQL syntax from a nested Elixir keyword list.

example

Example

iex> render(:query,
...>   user: {[id: 3], [
...>     :name,
...>     :age,
...>     :height, documents: [:filename, :url]]})
...>     documents: [
...>       :filename, :url]]})
...>       :url]]})
...>     ]]})
...>   ]}
...> )
"""
query {
  user(id: 3) {
    name
    age
    height
    documents {
      filename
      url
    }
  }
}\
"""