Batch loading resources in Absinthe using dataloader for a non-ecto struct

Hi! Late to the party, but I think there is a way to make it work by using undocumented %{batch: batch, item: item} dataloader interface.

object :vote_result do
    field(:top_upvoted_user,
          non_null(:user),
          resolve: dataloader(User, fn %{user_id: user_id}, _, _ ->
          # This is an undocumented dataloader/2 interface
          # see https://github.com/absinthe-graphql/absinthe/pull/1067
          %{batch: {{:one, User}, %{}}, item: user_id}
          end)
    )
end

In this case as long as User source is added the dataloader will use it.