hierarch v0.2.1 Hierarch.LTree View Source

Link to this section Summary

Functions

Concat path or string

Join list into a string path

Return the parent_id of the given ltree path

Return parent path of the given path

Return the root_id of the given ltree path

Split string path into an arry

Link to this section Functions

Concat path or string

Join list into a string path

Return the parent_id of the given ltree path

Examples

iex> LTree.parent_id("Top")
"Top"
iex> LTree.parent_id("")
nil
iex> LTree.parent_id("")
nil
iex> LTree.parent_id(nil)
nil

Return parent path of the given path

Link to this function

root_id(path, current_pk)

View Source

Return the root_id of the given ltree path

Examples

iex> LTree.root_id("Top", "Science")
"Top"
iex> LTree.root_id("", "Top")
"Top"
iex> LTree.root_id(nil, "Top")
"Top"

Options:

  • current_pk - the primary key of the current schema

Split string path into an arry