GreenFairy.Union (GreenFairy v0.3.0)
View SourceDefines a GraphQL union type with a clean DSL.
Usage
defmodule MyApp.GraphQL.Unions.SearchResult do
use GreenFairy.Union
union "SearchResult" do
types [:user, :post, :comment]
resolve_type fn
%MyApp.User{}, _ -> :user
%MyApp.Post{}, _ -> :post
%MyApp.Comment{}, _ -> :comment
_, _ -> nil
end
end
endOptions
:description- Description of the union type (can also use @desc)
Summary
Functions
Defines a GraphQL union type.