florinpatrascu / closure_table Goto Github PK
View Code? Open in Web Editor NEWClosure Table for Elixir - a simple solution for storing and manipulating complex hierarchies.
License: Apache License 2.0
Closure Table for Elixir - a simple solution for storing and manipulating complex hierarchies.
License: Apache License 2.0
Please publish the latest version on hex.pm for an easier dev experience.
distance
is more make sense; that's meaning the distance between two nodes.
depth
also means the tree depth.
Was attempting to use this in a database that uses :binary_id
as the primary ID type on all tables, but it immediately failed.
Mainly due to this line: https://github.com/florinpatrascu/closure_table/blob/main/lib/cte/adapter/ecto.ex#L309
This is the error thrown:
** (Ecto.Query.CastError) deps/closure_table/lib/cte/adapter/ecto.ex:307: value `"f74992a5-2ec4-438c-bfc4-97a31c925d0f"` in `select` cannot be cast to type :integer in query:
To be able to query immediate parent or child, the simplest way is to add depth
(or level or what is your preference) column to tree_paths
table
descendants/2
and ancestors/2
will accept a new option called depth
(or whatever that matches the new column).
Thanks for making this package, I am evaluating and would love to contribute, but it would be great to hear from author before introducing public data structure breaking change (e.g. change paths
to list of map instead.)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.