GqlCase (GqlCase v0.6.0)
View SourceThis module defines helper macros to work with Graphql and Guardian
Summary
Functions
Call this macro in the module you wish to load your GQL document from a file.
Call this macro in the module you wish to load your GQL document from a query string.
Call this macro in the module you've loaded a document into using load_gql_file
or load_gql_string
.
Functions
Call this macro in the module you wish to load your GQL document from a file.
It takes one argument, the path to a GQL file that contains a GraphQL query or mutation.
For example:
defmodule MyApp do
load_gql_file "assets/js/queries/MyQuery.gql"
# ...
end
Call this macro in the module you wish to load your GQL document from a query string.
It takes one argument, a string containing a GraphQL query or mutation.
For example:
defmodule MyApp do
load_gql_string """
query {
hello
}
"""
# ...
end
Call this macro in the module you've loaded a document into using load_gql_file
or load_gql_string
.
Calling this will execute the document loaded into the module against gql path loaded in the module.
It accepts a keyword list for options
. These options might be variables
and current_user
.
Returns the query result from the HTTP GQL call.
For example:
result = query_gql(variables: %{}, current_user: %{})
%{"data" => %{} = result