absinthe v1.3.0-beta.0 Absinthe.Resolution
The primary struct of resolution.
In many ways like the %Conn{}
from Plug
, the %Absinthe.Resolution{}
is the
piece of information that passed along from middleware to middleware as part of
resolution.
Summary
Functions
TODO: Deprecate
Handy function for applying user function result tuples to a resolution struct
Types
t() :: %Absinthe.Resolution{acc: %{optional(any) => any}, adapter: Absinthe.Adapter.t, arguments: term, context: map, definition: Blueprint.node_t, errors: [term], middleware: term, parent_type: Type.t, private: term, root_value: any, schema: Schema.t, source: any, state: field_state, value: term}
Information about the current resolution.
Contents
:adapter
- The adapter used for any name conversions.:definition
- The Blueprint definition for this field.:context
- The context passed toAbsinthe.run
.:root_value
- The root value passed toAbsinthe.run
, if any.:parent_type
- The parent type for the field.:schema
- The current schema.:source
- The resolved parent object; source of this field.
To access the schema type for this field, see the definition.schema_node
.
Functions
Handy function for applying user function result tuples to a resolution struct
User facing functions generally return one of several tuples like {:ok, val}
or {:error, reason}
. This function handles applying those various tuples
to the resolution struct.
The resolution state is updated depending on the tuple returned. :ok
and
:error
tuples set the state to :resolved
, whereas middleware tuples set it
to :unresolved
.
This is useful for middleware that wants to handle user facing functions, but does not want to duplicate this logic.