zf

zenflows testing
git clone https://s.sonu.ch/~srfsh/zf.git
Log | Files | Refs | Submodules | README | LICENSE

fragment.ex (1071B)


      1 defmodule Absinthe.Language.Fragment do
      2   @moduledoc false
      3 
      4   alias Absinthe.{Blueprint, Language}
      5 
      6   defstruct name: nil,
      7             type_condition: nil,
      8             directives: [],
      9             selection_set: nil,
     10             loc: %{line: nil}
     11 
     12   @type t :: %__MODULE__{
     13           name: String.t(),
     14           type_condition: nil | Language.NamedType.t(),
     15           directives: [Language.Directive.t()],
     16           selection_set: Language.SelectionSet.t(),
     17           loc: Language.loc_t()
     18         }
     19 
     20   defimpl Blueprint.Draft do
     21     def convert(node, doc) do
     22       %Blueprint.Document.Fragment.Named{
     23         name: node.name,
     24         type_condition: Blueprint.Draft.convert(node.type_condition, doc),
     25         selections: Blueprint.Draft.convert(node.selection_set.selections, doc),
     26         directives: Blueprint.Draft.convert(node.directives, doc),
     27         source_location: source_location(node)
     28       }
     29     end
     30 
     31     defp source_location(%{loc: nil}) do
     32       nil
     33     end
     34 
     35     defp source_location(%{loc: loc}) do
     36       Blueprint.SourceLocation.at(loc)
     37     end
     38   end
     39 end