Resolves dotted identifier paths (e.g., author.name, post.author.company.name)
into Ecto dynamic expressions with named bindings and join specifications.
Summary
Functions
Resolves a dotted identifier name against a schema, returning a dynamic expression referencing the final field and a list of join specs needed.
Functions
Resolves a dotted identifier name against a schema, returning a dynamic expression referencing the final field and a list of join specs needed.
Join spec format
%{binding: atom, assoc: atom, parent: :root | atom}Examples
iex> resolve("author.name", MyApp.Post)
{:ok, dynamic, [%{binding: :author, assoc: :author, parent: :root}]}
iex> resolve("author.company.company_name", MyApp.Post)
{:ok, dynamic, [
%{binding: :author, assoc: :author, parent: :root},
%{binding: :author__company, assoc: :company, parent: :author}
]}