We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hey!
These are some helpers that I often end up needing when working with Relay connections
defmodule GraphQL.Connection do import Absinthe.Resolution, only: [project: 1] def fields(info) do edge = project(info) |> Enum.find(fn f -> f.name == "edges" end) node = ((edge && edge.selections) || []) |> Enum.find(fn f -> f.name == "node" end) ((node && node.selections) || []) |> Enum.map(fn f -> String.to_atom(f.name) end) |> MapSet.new() end def map(%{edges: edges} = _conn, f) do Enum.map(edges, fn %{node: node} -> f.(node) end) end def update(%{edges: edges} = conn, f) do edges = Enum.map(edges, fn edge -> %{edge | node: f.(edge.node)} end) %{conn | edges: edges} end end
would it make sense to integrate some additional helpers to make it easier to work with connections into absinthe_relay?
absinthe_relay
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hey!
These are some helpers that I often end up needing when working with Relay connections
would it make sense to integrate some additional helpers to make it easier to work with connections into
absinthe_relay
?The text was updated successfully, but these errors were encountered: