Conversation
| end | ||
|
|
||
| defp field_data(fields, errors, acc \\ []) | ||
| defp field_data([], errors, acc), do: {{:lists.reverse(acc)}, errors} |
There was a problem hiding this comment.
This line here in the normal result phase is:
defp field_data([], errors, acc), do: {Map.new(acc), errors}
This is the only line in the entire file that is different.
There was a problem hiding this comment.
The main challenge here is that for large results this function gets called a LOT, and so I want to avoid dynamic lookup. One idea is to use macros:
defmodule BlogWeb.OrdGraphQLResult do
use Absinthe.ResultPhase
def to_object_result(acc) do
{:lists.reverse(acc)}
# or you could do `OrdMap.new(:lists.reverse(acc))`
end
end
| pipeline_opts = Keyword.put(pipeline_opts, :result_phase, BlogWeb.OrdGraphQLResult) | ||
| config.schema_mod | ||
| |> Absinthe.Pipeline.for_document(pipeline_opts) | ||
| |> Absinthe.Pipeline.replace(Absinthe.Phase.Document.Result, BlogWeb.OrdGraphQLResult) |
There was a problem hiding this comment.
Configuration here is just slightly more complicated than we want.
|
Hey @benwilson512, I spent today's afternoon and evening trying to install this project's dependencies and run a server, but I wasn't lucky. I encountered many platform specific (Windows) and maybe general problems, e.g. with:
Well, I've managed to compile Elixir 1.6.0-dev from source code - it solved some issues and I've updated this guide: https://github.com/elixir-lang/elixir/wiki/Windows. It's not possible for me to switch to another platform now, so I have to wait for official OTP 21 release and then I'll try it again. Sorry for that and thanks for your time and this PR. |
|
Hey! Sorry about the difficulties, I'll get a PR up that shows the main point I'm going for without the challenging libraries you have mentioned. |
|
Should go up sometime tomorrow. |
|
Hey! Success! I've managed to run this with Nanobox and Docker. and add flag to I think a guide about running absinthe_tutorial with Nanobox will be useful. And a guide with Nanobox and Elm frontend for absinthe_tutorial as well. |
prepared for nanobox, graphiql ordered
Some things to note about this:
OrdMapor:orddictor whatever it is you end up using won't be as ergonomic to work with in Elixir itself as a map, so this preserves the normalAbsinthe.runbehaviour.