0.0
No commit activity in last 3 years
No release in over 3 years
PostgreSQL LTree helper with sequel ORM
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0.17.0, < 2
>= 5.26.0
 Project Readme

SequelPgLtree

notice

Sequel ORM postgresql ltree helper inspired by https://github.com/sjke/pg_ltree

Installation

Add this line to your application's Gemfile:

gem 'sequel_pg_ltree'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sequel_pg_ltree

Usage

 id | path
----+-------
  1 | A
  2 | A.B
  3 | A.C
  4 | A.C.D
  5 | A.C.E
  6 | A.C.F
  7 | A.B.G
class Tree < Sequel::Model(:tree)
  plugin :pg_ltree, :column => :path
end

Tree.find(id: 2).root.path # => A
Tree.find(id: 2).parent.path # => A
Tree.where(id: 1).first.children.each do |c|
  c[:path]
end # => A.B  A.C

TODO

tests should be added