Created
January 10, 2017 17:15
-
-
Save bruce/e1e927c5130a850f26e29b5fbdc1b897 to your computer and use it in GitHub Desktop.
Example resolver helper for pulling data from another source field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ExampleSchema do | |
use Absinthe.Schema | |
# rest of schema | |
object :message do | |
field :date, :datetime do | |
resolve source_field(:inserted_at) | |
end | |
end | |
def source_field(name) do | |
fn source, _, _ -> | |
{:ok, Map.get(source, name)} | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment