hierarch v0.2.1 Hierarch.Query.Descendants View Source

Link to this section Summary

Functions

Return query expressions for descendants of a query

Return query expressions for descendants

Link to this section Functions

Return query expressions for descendants of a query

import Ecto.Query

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

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

query(struct, opts \\ [])

View Source

Return query expressions for descendants

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.Descendants.query()
|> Repo.all

# or

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