     from c in q, where: c.author == ^author
   end
 
+  def select_schema(blockchain) when is_atom(blockchain) do
+    case blockchain do
+      :steem -> Glasnost.Steem.Comment
+      :golos -> Glasnost.Golos.Comment
+    end
+  end
+
 end

  import Ecto.Query

  def all(%{blockchain: blockchain, author: author, tag: tag}, _info) do
    schema = case blockchain do
      "steem" -> Glasnost.Steem.Comment
      "golos" -> Glasnost.Golos.Comment
    end
    q = (from c in schema, order_by: [desc: c.created])
      |> add_to_query(:tag, tag)
      |> add_to_query(:author, author)

  end

  def find(%{"blockchain" => blockchain, author: a, permlink: p}, _info) do
    schema = select_schema(blockchain)
    {:ok, Repo.find(schema, author: a, permlink: p)}
  end

