activerecord-hierarchical_query 1.2.2 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -10
- data/lib/active_record/hierarchical_query/cte/columns.rb +17 -3
- data/lib/active_record/hierarchical_query/version.rb +1 -1
- metadata +11 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dbfe38ba545752409503f8e35bac2dc57e10f01b3b52692b305925727095c371
|
|
4
|
+
data.tar.gz: b8cf2743d2a55b857c685be2adfd16ad4b881dae39029f173aaf60dcb7214726
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 54dc3bc71efd8b69918175ca63ccf73161651f326da7c827b6a4dc6c1fcc1a19c95645e8bcddd6bb61cbb7959859ecf79da2bed72a69548aa560f595ad7fbfc6
|
|
7
|
+
data.tar.gz: ac232b4cb3a9ed883df916b57f51c48548e12b651d14524615a5dc3559c9727c358521bda0427c980a96175d6a2985a83c0d41411e24a05e37afcc6832b6bbd8
|
data/README.md
CHANGED
|
@@ -13,21 +13,13 @@ in hierarchical order using hierarchical query builder.
|
|
|
13
13
|
|
|
14
14
|
## Requirements
|
|
15
15
|
|
|
16
|
-
- ActiveRecord >= 5.0, <
|
|
16
|
+
- ActiveRecord >= 5.0, < 7.1
|
|
17
17
|
- PostgreSQL >= 8.4
|
|
18
|
-
- Postgres Gem >= 0.21, < 1.
|
|
18
|
+
- Postgres Gem >= 0.21, < 1.3
|
|
19
19
|
|
|
20
20
|
Note that though PostgresSQL 8.4 and up should work, this library
|
|
21
21
|
is tested on PostgresSQL 10.5.
|
|
22
22
|
|
|
23
|
-
### Rails Version
|
|
24
|
-
|
|
25
|
-
**Rails 4 support has ended.**
|
|
26
|
-
|
|
27
|
-
If you have trouble with Rails 5.1 or 5.0, try upgrading to Rails 5.2
|
|
28
|
-
first. Rails 6 should work, but please report issues immediately as
|
|
29
|
-
support is recent.
|
|
30
|
-
|
|
31
23
|
## In a nutshell
|
|
32
24
|
|
|
33
25
|
### Traverse trees
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
require 'arel/visitors/depth_first'
|
|
2
|
-
|
|
3
1
|
module ActiveRecord
|
|
4
2
|
module HierarchicalQuery
|
|
5
3
|
module CTE
|
|
@@ -18,7 +16,23 @@ module ActiveRecord
|
|
|
18
16
|
|
|
19
17
|
private
|
|
20
18
|
def connect_by_columns
|
|
21
|
-
|
|
19
|
+
columns = []
|
|
20
|
+
traverse(@query.join_conditions) do |node|
|
|
21
|
+
columns << node.name.to_s if node.is_a?(Arel::Attributes::Attribute)
|
|
22
|
+
end
|
|
23
|
+
columns
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def traverse(ast, &blck)
|
|
27
|
+
if ast && ast.respond_to?(:left) && ast.left
|
|
28
|
+
traverse(ast.left, &blck)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
if ast && ast.respond_to?(:right) && ast.right
|
|
32
|
+
traverse(ast.right, &blck)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
yield ast
|
|
22
36
|
end
|
|
23
37
|
end
|
|
24
38
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: activerecord-hierarchical_query
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alexei Mikhailov
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2022-01-21 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activerecord
|
|
@@ -20,7 +20,7 @@ dependencies:
|
|
|
20
20
|
version: '5.0'
|
|
21
21
|
- - "<"
|
|
22
22
|
- !ruby/object:Gem::Version
|
|
23
|
-
version: '6.
|
|
23
|
+
version: '6.2'
|
|
24
24
|
type: :runtime
|
|
25
25
|
prerelease: false
|
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -30,7 +30,7 @@ dependencies:
|
|
|
30
30
|
version: '5.0'
|
|
31
31
|
- - "<"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '6.
|
|
33
|
+
version: '6.2'
|
|
34
34
|
- !ruby/object:Gem::Dependency
|
|
35
35
|
name: pg
|
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -40,7 +40,7 @@ dependencies:
|
|
|
40
40
|
version: '0.21'
|
|
41
41
|
- - "<"
|
|
42
42
|
- !ruby/object:Gem::Version
|
|
43
|
-
version: '1.
|
|
43
|
+
version: '1.3'
|
|
44
44
|
type: :runtime
|
|
45
45
|
prerelease: false
|
|
46
46
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -50,19 +50,19 @@ dependencies:
|
|
|
50
50
|
version: '0.21'
|
|
51
51
|
- - "<"
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '1.
|
|
53
|
+
version: '1.3'
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
55
|
name: bundler
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
57
57
|
requirements:
|
|
58
|
-
- - "
|
|
58
|
+
- - ">="
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
60
|
version: '1.16'
|
|
61
61
|
type: :development
|
|
62
62
|
prerelease: false
|
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements:
|
|
65
|
-
- - "
|
|
65
|
+
- - ">="
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
67
|
version: '1.16'
|
|
68
68
|
- !ruby/object:Gem::Dependency
|
|
@@ -85,14 +85,14 @@ dependencies:
|
|
|
85
85
|
requirements:
|
|
86
86
|
- - "~>"
|
|
87
87
|
- !ruby/object:Gem::Version
|
|
88
|
-
version: '3.
|
|
88
|
+
version: '3.10'
|
|
89
89
|
type: :development
|
|
90
90
|
prerelease: false
|
|
91
91
|
version_requirements: !ruby/object:Gem::Requirement
|
|
92
92
|
requirements:
|
|
93
93
|
- - "~>"
|
|
94
94
|
- !ruby/object:Gem::Version
|
|
95
|
-
version: '3.
|
|
95
|
+
version: '3.10'
|
|
96
96
|
- !ruby/object:Gem::Dependency
|
|
97
97
|
name: database_cleaner
|
|
98
98
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
169
169
|
- !ruby/object:Gem::Version
|
|
170
170
|
version: '0'
|
|
171
171
|
requirements: []
|
|
172
|
-
rubygems_version: 3.
|
|
172
|
+
rubygems_version: 3.2.22
|
|
173
173
|
signing_key:
|
|
174
174
|
specification_version: 4
|
|
175
175
|
summary: Recursively traverse trees using a single SQL query
|