View Source graphql_schema (graphql v0.17.1)

Summary

Types

-type directive_location() ::
          'QUERY' | 'MUTATION' | 'SUBSCRIPTION' | 'FIELD' | 'FRAGMENT_DEFINITION' | 'FRAGMENT_SPREAD' |
          'INLINE_FRAGMENT' | 'SCHEMA' | 'SCALAR' | 'OBJECT' | 'FIELD_DEFINITION' |
          'ARGUMENT_DEFINITION' | 'INTERFACE' | 'UNION' | 'ENUM' | 'ENUM_VALUE' | 'INPUT_OBJECT' |
          'INPUT_FIELD_DEFINITION'.
-type directive_type() ::
          #directive_type{id :: binary(),
                          description :: undefined | binary(),
                          locations :: [directive_location()],
                          args :: #{binary() => schema_arg()}}.
-type endpoint() :: atom().
-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 input_object_type() ::
          #input_object_type{id :: binary(),
                             description :: binary(),
                             directives :: [graphql:directive()],
                             fields :: #{binary() => schema_arg()}}.
-type interface_type() ::
          #interface_type{id :: binary(),
                          description :: binary(),
                          resolve_type :: mod() | fun((any()) -> {ok, atom()} | {error, term()}),
                          directives :: [graphql:directive()],
                          fields :: #{binary() => schema_field()}}.
-type mod() :: atom().
-type object_type() ::
          #object_type{id :: binary(),
                       description :: binary(),
                       directives :: [graphql:directive()],
                       resolve_module :: mod(),
                       fields :: #{binary() => schema_field()},
                       interfaces :: [binary()]}.
-type operation_type() ::
          {query, pos_integer()} | {mutation, pos_integer()} | {subscription, pos_integer()}.
-type resolver() :: fun((ctx, term(), binary(), resolver_args()) -> term()).
-type resolver_args() :: #{binary() => term()}.
-type root_schema() ::
          #root_schema{id :: atom(),
                       query :: undefined | binary(),
                       mutation :: undefined | binary(),
                       subscription :: undefined | binary(),
                       directives :: [graphql:directive()],
                       interfaces :: [binary()]}.
-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_field() ::
          #schema_field{ty :: schema_type(),
                        description :: binary() | undefined,
                        resolve :: undefined | resolver(),
                        deprecation :: undefined | binary(),
                        directives :: [graphql:directive()],
                        args :: #{binary() => schema_arg()}}.
-type schema_object() ::
          object_type() |
          interface_type() |
          scalar_type() |
          input_object_type() |
          union_type() |
          enum_type() |
          directive_type() |
          root_schema().
-type schema_type() ::
          {non_null, schema_base_type()} |
          {non_null, {list, schema_base_type()}} |
          {list, schema_base_type()} |
          schema_base_type().
-type union_type() ::
          #union_type{id :: binary(),
                      description :: binary(),
                      resolve_type :: mod() | fun((any()) -> {ok, atom()} | {error, term()}),
                      directives :: [graphql:directive()],
                      types :: [binary() | {name, non_neg_integer(), binary()}]}.

Functions

-spec all(endpoint_context()) -> [any()].
Link to this function

code_change(OldVsn, S, Aux)

View Source
-spec code_change(term(), S, term()) -> {ok, S} when S :: #state{context :: endpoint_context()}.
Link to this function

get(Endpoint_context, ID)

View Source
-spec get(endpoint_context(), binary() | 'ROOT') -> schema_object().
-spec get_endpoint_ctx() -> endpoint_context().
-spec get_endpoint_ctx(endpoint()) -> endpoint_context().
-spec handle_call(M, any(), S) -> {reply, term(), S}
                     when S :: #state{context :: endpoint_context()}, M :: term().
-spec handle_cast(any(), S) -> {noreply, S} when S :: #state{context :: endpoint_context()}.
-spec handle_info(term(), S) -> {noreply, S} when S :: #state{context :: endpoint_context()}.
-spec init([atom()]) -> {ok, #state{context :: endpoint_context()}}.
-spec insert(endpoint_context(), any(), any()) -> ok | {error, Reason :: term()}.
-spec load(endpoint_context(), any()) -> ok | {error, Reason} when Reason :: term().
Link to this function

load_schema(Ep, Root_schema)

View Source
-spec load_schema(endpoint_context(),
                  #root_schema{id :: atom(),
                               query :: undefined | binary(),
                               mutation :: undefined | binary(),
                               subscription :: undefined | binary(),
                               directives :: [graphql:directive()],
                               interfaces :: [binary()]}) ->
                     ok.
Link to this function

lookup(Endpoint_context, ID)

View Source
-spec lookup(endpoint_context(), binary() | 'ROOT') -> schema_object() | not_found.
Link to this function

lookup_interface_implementors(Endpoint_context, IFaceID)

View Source
-spec lookup_interface_implementors(endpoint_context(), binary()) -> [binary()].
-spec reset() -> ok.
-spec reset(endpoint_context()) -> ok.
Link to this function

resolve_root_type(_, Root_schema)

View Source
-spec resolve_root_type(undefined | operation_type(), root_schema()) -> undefined | binary().
-spec start_link() -> any().
-spec start_link(endpoint()) -> any().
-spec terminate(any(), any()) -> any().
Link to this function

validate_enum(Ep, EnumID, EnumValue)

View Source
-spec validate_enum(endpoint_context(), binary(), binary()) ->
                       ok | not_found |
                       {other_enums,
                        [#enum_type{id :: binary(),
                                    description :: binary(),
                                    resolve_module :: mod(),
                                    directives :: [graphql:directive()],
                                    values :: #{integer() => enum_value()}}]}.