lode/preload
The preload specification — what repo.preload and query.preload accept.
Mirrors Ecto’s preload([:comments, comments: :author]): a list of
association names to load, each optionally with its own nested preloads.
[preload.one(“comments”)] // :comments [preload.nest(“comments”, [preload.one(“author”)])] // [comments: :author]
Each preload also carries a Strategy: Batched (the default — one extra
query per association, N+1-free) or Joined (load the association in the
same query via a JOIN; Ecto’s preload-through-a-join-binding). Joined only
takes effect through query.preload + repo.all/repo.one on a SQL
adapter, and only for has_many/has_one associations (see repo.all).
Types
Values
pub fn join(name: String) -> Preload
Preload an association in the parent query via a JOIN (Ecto’s preload through
a join binding). SQL adapters only, has_many/has_one only; nested
preloads on the joined children still run batched. See repo.all.
pub fn join_nest(
name: String,
nested nested: List(Preload),
) -> Preload
Like join, then preload nested on the joined children (batched).