maple v0.3.0 Maple.Helpers View Source

Helper functions to create the dybamic function in the macro. Helps keep the code somewhat clean and maintainable

Link to this section Summary

Functions

Creates a custom map out of the parsed function data which is easier to work with when creating custom functions

Creates a string to interpolate into the query or mutation that represents the variables defined in the variables dictionary. Ex. id: $id

Declares all the variables and their types that will be used inside the specific function

Emits a log warning if the function has been marked deprecared

Finds all parameters that are missing from the required parameters list

Takes the data for a mutation function and an adapter and creates the AST that calls the mutation function on the adapter with the passed params and fields

Takes the data for a query function and an adapter and creates the AST that calls the query function on the passed adapter with the passed fields

Takes the data for a query function and an adapter and creates the AST that calls the query function on the passed adapter with the passed parameters and fields

Returns a map of the GraphQL declared types for the arguments

Returns all the parameters flagged as required

Link to this section Functions

Link to this function assign_function_params(func) View Source
assign_function_params(map) :: map

Creates a custom map out of the parsed function data which is easier to work with when creating custom functions.

Link to this function declare_params(params) View Source
declare_params(map) :: String.t

Creates a string to interpolate into the query or mutation that represents the variables defined in the variables dictionary. Ex. id: $id

Link to this function declare_variables(params, types) View Source
declare_variables(map, map) :: String.t

Declares all the variables and their types that will be used inside the specific function

Link to this function deprecated?(bool, name, reason) View Source
deprecated?(boolean, String.t, String.t) :: nil

Emits a log warning if the function has been marked deprecared

Link to this function find_missing(params, required_params) View Source
find_missing(map, list) :: list

Finds all parameters that are missing from the required parameters list

Link to this function generate_mutation(function, adapter) View Source
generate_mutation(map, atom) :: tuple

Takes the data for a mutation function and an adapter and creates the AST that calls the mutation function on the adapter with the passed params and fields

Link to this function generate_one_arity_query(function, adapter) View Source
generate_one_arity_query(map, atom) :: tuple

Takes the data for a query function and an adapter and creates the AST that calls the query function on the passed adapter with the passed fields

Link to this function generate_subscription(function, adapter) View Source
generate_subscription(map, atom) :: tuple
Link to this function generate_two_arity_query(function, adapter) View Source
generate_two_arity_query(map, atom) :: tuple

Takes the data for a query function and an adapter and creates the AST that calls the query function on the passed adapter with the passed parameters and fields

Link to this function get_param_types(args) View Source
get_param_types(map) :: map

Returns a map of the GraphQL declared types for the arguments

Link to this function get_required_params(args) View Source
get_required_params(map) :: list

Returns all the parameters flagged as required