hierarch v0.2.1 Hierarch.Query.Children View Source

Link to this section Summary

Functions

Return query expressions for children of a query

Return query expressions for children

Link to this section Functions

Return query expressions for children of a query

import Ecto.Query

query = from t in Catelog, where: [..]

query
|> Hierarch.Query.Children.query()
|> Repo.all
Link to this function

query(struct, opts \\ [])

View Source

Return query expressions for children

Options

  • :with_self - when true to include itself. Defaults to false.
%Catelog{
  id: "06a84054-8827-42c2-9b75-25ed75e6d5f8",
  name: "Top.Hobbies",
  path: "a9ae8f40-b016-4bf9-8224-e2755466e699",
}
|> Hierarch.Query.Children.query()
|> Repo.all

# or

%Catelog{
  id: "06a84054-8827-42c2-9b75-25ed75e6d5f8",
  name: "Top.Hobbies",
  path: "a9ae8f40-b016-4bf9-8224-e2755466e699",
}
|> Catelog.children()
|> Repo.all