Cognac (Cognac v0.8.0) View Source
Link to this section Summary
Functions
Convert keyword list/tuple list to GraphQL mutation query string
Marks type as non-null, appending with an exclamation mark (!).
Convert keyword list/tuple list to GraphQL query string
Convert keyword list/tuple list to GraphQL subscription query string
Marks value as variable, helping with correct annotation using ($) and all that jazz.
Link to this section Functions
Convert keyword list/tuple list to GraphQL mutation query string
iex> mutation = [hero: [:name, friends: [:name]]]
iex> Cognac.mutation(mutation) |> IO.puts
mutation{updateHero(name:"Steve"){name}}
Options
:output
:iodata
(default) - Outputs as IO data:binary
- Outputs query as a binary string
pretty
false
(default) - Outputs minimal querytrue
- Outputs prettified query with indentation and linebreaks
Specs
Marks type as non-null, appending with an exclamation mark (!).
Convert keyword list/tuple list to GraphQL query string
iex> query = [hero: [:name, friends: [:name]]]
iex> Cognac.query(query) |> IO.puts
# query{hero{name friends{name}}}
Options
:output
:iodata
(default) - Outputs as IO data:binary
- Outputs query as a binary string
pretty
false
(default) - Outputs minimal querytrue
- Outputs prettified query with indentation and linebreaks
Specs
Convert keyword list/tuple list to GraphQL subscription query string
iex> subscription = [heroUpdated: [:name]]
iex> Cognac.subscription(subscription) |> IO.puts
subscription{heroUpdated{name}}
Options
:output
:iodata
(default) - Outputs as IO data:binary
- Outputs query as a binary string
pretty
false
(default) - Outputs minimal querytrue
- Outputs prettified query with indentation and linebreaks
Specs
Marks value as variable, helping with correct annotation using ($) and all that jazz.