View Source graphql (graphql v0.17.1)

Summary

Types

-type ast() :: document().
-type context() :: #{atom() => any()}.
-type defer_map() :: #{worker => pid(), timeout => non_neg_integer(), apply => [fun()]}.
-type directive() ::
          #directive{id :: graphql:name(),
                     args :: #{binary() => term()} | [{any(), any()}],
                     schema :: any()}.
-type document() :: #document{definitions :: [any()]}.
-type endpoint_context() ::
          #endpoint_context{name :: atom(), pid :: pid(), enums_tab :: atom(), objects_tab :: atom()}.
-type enum_type() ::
          #enum_type{id :: binary(),
                     description :: binary(),
                     resolve_module :: mod(),
                     directives :: [graphql:directive()],
                     values :: #{integer() => enum_value()}}.
-type enum_value() ::
          #enum_value{val :: binary(),
                      description :: binary(),
                      directives :: [graphql:directive()],
                      deprecation :: undefined | binary()}.
-type json() :: number() | binary() | true | false | null | #{binary() | atom() => json()} | [json()].
-type mod() :: atom().
-type name() :: {name, pos_integer(), binary()} | binary().
-type param_context() :: json().
-type resolver() :: fun((ctx, term(), binary(), resolver_args()) -> term()).
-type resolver_args() :: #{binary() => term()}.
-type result() :: {ok, term()} | {error, term()} | {defer, token()} | {defer, token(), defer_map()}.
-type scalar_type() ::
          #scalar_type{id :: binary(),
                       description :: binary(),
                       directives :: [graphql:directive()],
                       resolve_module :: mod()}.
-type schema_arg() ::
          #schema_arg{ty :: schema_type(),
                      default :: any(),
                      description :: binary(),
                      directives :: [graphql:directive()]}.
-type schema_base_type() :: scalar_type() | enum_type() | binary().
-type schema_definition() :: {atom(), #{atom() => term()}}.
-type schema_field() ::
          #schema_field{ty :: schema_type(),
                        description :: binary() | undefined,
                        resolve :: undefined | resolver(),
                        deprecation :: undefined | binary(),
                        directives :: [graphql:directive()],
                        args :: #{binary() => schema_arg()}}.
-type schema_type() ::
          {non_null, schema_base_type()} |
          {non_null, {list, schema_base_type()}} |
          {list, schema_base_type()} |
          schema_base_type().
-type token() :: {'$graphql_token', pid(), reference(), reference()}.

Functions

-spec execute(document()) -> #{atom() => json()}.
-spec execute(context(), document()) -> #{atom() => json()}.
-spec execute(endpoint_context(), context(), document()) -> #{atom() => json()}.
Link to this function

format_errors(Ctx, Errs)

View Source
-spec get_endpoint(atom()) -> endpoint_context().
-spec insert_root(schema_definition()) -> ok.
-spec insert_root(endpoint_context(), schema_definition()) -> ok.
Link to this function

insert_schema_definition(Defn)

View Source
-spec insert_schema_definition(schema_definition()) -> ok | {error, Reason} when Reason :: term().

insert_schema_definition/1 loads a schema definition into the Graph Schema

Link to this function

insert_schema_definition(Ep, Defn)

View Source
-spec insert_schema_definition(endpoint_context(), schema_definition()) -> ok | {error, Reason}
                                  when Reason :: term().
Link to this function

load_schema(Mapping, Input)

View Source
Link to this function

load_schema(Ep, Mapping, Input)

View Source
-spec monitor(pid(), result()) -> result().
-spec parse(binary() | string()) -> {ok, document()} | {error, {scanner_error | parser_error, term()}}.
-spec reply_cast(token(), term()) -> ok.
-spec token(#{defer_process := pid(), defer_request_id := reference()}) -> token().
-spec type_check(document()) -> {ok, #{atom() => term()}}.
-spec type_check(endpoint_context(), document()) -> {ok, #{atom() => term()}}.
Link to this function

type_check_params(FunEnv, OpName, Vars)

View Source
-spec type_check_params(any(), any(), any()) -> param_context().
Link to this function

type_check_params(Ep, FunEnv, OpName, Vars)

View Source
-spec type_check_params(endpoint_context(), any(), any(), any()) -> param_context().
-spec validate(document()) -> ok | {error, term()}.
-spec validate_schema() -> ok | {error, any()}.
-spec validate_schema(endpoint_context()) -> ok | {error, any()}.