Schemer.Resolution (schemer v0.1.0)
Resolve a path.
contents
Contents
:schema
- The current schema.:resolve_name
- The resolve_name, the first arugment that passed to the resolver function.:context
- The context passed fromSchemer.run
.:result
- The result struct of the resolution.:options
- The other options of the resolution.
Link to this section Summary
Link to this section Types
Link to this type
resolve_name()
@type resolve_name() :: atom()
Link to this type
resolver_result()
@type resolver_result() :: resolver_result(term())
Link to this type
resolver_result(value)
@type t() :: %Schemer.Resolution{ context: map(), options: Keyword.t(), resolve_name: resolve_name(), result: map(), schema: Schemer.Schema.t() }
Link to this section Functions
Link to this function
get_result(res, path)
@spec get_result(t(), [Schemer.Node.t()]) :: nil | term()
Get the value from the path.
Link to this function
path(path)
@spec path([Schemer.Node.t() | String.t()]) :: [String.t()]
Get the current path.
Each Absinthe.Resolution
struct holds the current result path as a list of
nodes. Usually however you don't need the full AST list
and instead just want the path that will eventually end up in the result.
For that, use this function.
examples
Examples
Given some identifier:
"users.user_uuid"
If you called this function inside a resolver on the users user_uuid field it returns a value like:
resolve fn _, _, execution, _ ->
Schemer.Resolution.path(execution.path) #=> ["users", "user_uuid"]
end
Link to this function
resolve(resolution, path_str)
@spec resolve(t(), path_str :: [String.t()]) :: {:ok, [Schemer.Node.t()], t()} | {:error, term()}