arbor icon indicating copy to clipboard operation
arbor copied to clipboard

Ecto elixir adjacency list and tree traversal. Supports Ecto versions 2 and 3.

Results 18 arbor issues
Sort by recently updated
recently updated
newest added

Cause: Prefix fields with ecto_ to avoid conflicts https://github.com/elixir-ecto/ecto/commit/b2a2b75067ad9b5b8298ea911053969de1fd93a5 Solves issues: https://github.com/coryodaniel/arbor/issues/36 https://github.com/coryodaniel/arbor/issues/35

After adding this dep to my `mix.exs` & running`mix deps.get` which ran fine. I added to my schema that has a parent_id field `use Arbor.Tree, foreign_key_type: :binary_id` `belongs_to :parent, __MODULE__`...

https://github.com/coryodaniel/arbor/blob/1d3c610f4c1cc334af332aa11516cf7d543d2209/lib/arbor/tree.ex#L39 It is now :ecto_struct_fields in Ecto 3.8 Although switching to :ecto_struct_fields would also imply ecto >= 3.8 and elixir ~> 1.10

Howdy! So right now when we're using Arbor, the `fragment/1` call in `ancestors/1` and `descendants/1` are essentially hard coded at compile time because of the restrictions of `fragment/1`. However, it...

This may be a personal preference, but I think this aligns more closely to similar projects.

Add a second descendants option that instead of tracking depth tracks the parent id and organizes the results in a tree structure instead of a list.

Postgres has great native support for trees using the [ltree and lquery](https://www.postgresql.org/docs/current/static/ltree.html) functions. Maybe it deserves some look to see if it can be inserted into the library.

Returns Ancestors + source struct This is probably pretty easy to do now using the same CTE as ancestors but joining on id rather than parent_id... ```elixir breadcrumbs = Comment.path(comment)...