Ecto usage patterns

defmodule MyApp.Explore do
  defmacro __using__(_) do
    quote do
      alias App.Repo
      alias App.UserContext.User
      import Ecto.Query
    end
  end
end

and then you only need to call use MyApp.Explore whenever you need to do something with your data.

6 Likes