maple v0.1.1 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

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

Joins key-value pairs of a map in the GraphQL syntax

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 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_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

Link to this function join_params(params, param_types) View Source
join_params(map, map) :: String.t

Joins key-value pairs of a map in the GraphQL syntax