Packages

Hierarchy structure for ecto models with PostgreSQL LTree.

Current section

Files

Jump to
hierarch lib query roots.ex
Raw

lib/query/roots.ex

defmodule Hierarch.Query.Roots do
import Ecto.Query
@doc """
Return query expressions for roots
"""
def query(schema) do
roots_path = ""
from(
t in schema,
where: field(t, ^schema.__hierarch__(:path_column)) == ^roots_path
)
end
end