View Source GraphQLDocument.Type (GraphQLDocument v0.2.2)
A Type is a reference to a TypeDefinition defined by a GraphQL service.
Types are used in GraphQLDocument
when defining Variables. (See GraphQLDocument.Variable
)
Link to this section Summary
Functions
Returns a Type as an iolist to be inserted into a Document.
Link to this section Types
@type option() :: {:null, boolean()}
Options to be passed along with a Type.
null
- Whether it can be null
@type t() :: GraphQLDocument.Name.t() | [t()] | {GraphQLDocument.Name.t() | [t()], [option()]}
A named type or a list type.
Can be wrapped in a tuple to provide options, which are used to specify if it can be null.
See render/1
for examples.
Link to this section Functions
Returns a Type as an iolist to be inserted into a Document.
examples
Examples
iex> render(Int)
...> |> IO.iodata_to_binary()
"Int"
iex> render(Boolean)
...> |> IO.iodata_to_binary()
"Boolean"
iex> render([String])
...> |> IO.iodata_to_binary()
"[String]"
iex> render({Boolean, null: false})
...> |> IO.iodata_to_binary()
"Boolean!"
iex> render({[{Boolean, null: false}], null: false})
...> |> IO.iodata_to_binary()
"[Boolean!]!"