Follow

Preloading in Elixir/Ecto
This is a pattern for preloading in Elixir that I have adopted for a few projects. I’m sharing it here for reference. The idea is to have one place to define your preloads instead of in every query.
@preloads [:listens]
defp with_preloads(query), do: preload(query, ^@preloads)
def preload_artist(a.. (inhji.de/notes/preloading-in-e)

Sign in to participate in the conversation
chaos.social

chaos.social – a Fediverse instance for & by the Chaos community