activerecord-setops 0.1.0 → 0.1.5
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/.github/workflows/ruby.yml +1 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +14 -13
- data/README.md +17 -11
- data/activerecord-setops.gemspec +5 -3
- data/lib/active_record/setops/version.rb +1 -1
- data/lib/activerecord-setops.rb +1 -0
- metadata +41 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a20f3b066430604f655a59637ee7ab8f68b5921cdb2351f1075fd79eaec01eff
|
4
|
+
data.tar.gz: b96500fece6a4db99e65adebe6a84b45aa4333b173cc29f2049d77e88627b731
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63c7c897c1f234630192a65e51298e731f37df7b9de3dabf74a3c0e8f6f9c1fbabfdb4501666f1731a42e6b8eb2b7964b5678a9823df5687b5d7bef24085d4a1
|
7
|
+
data.tar.gz: fe263992151cca1d2abc188dc74dd724e1613d1bbb893b0ee1ccee9a79d360ff206011e877c046b2fd4ffbfa93e3beb268d1c56f37e261edec78b94250438090
|
data/.github/workflows/ruby.yml
CHANGED
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
data/Gemfile.lock
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
activerecord-setops (0.1.
|
4
|
+
activerecord-setops (0.1.4)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
activemodel (5.2.4.
|
10
|
-
activesupport (= 5.2.4.
|
11
|
-
activerecord (5.2.4.
|
12
|
-
activemodel (= 5.2.4.
|
13
|
-
activesupport (= 5.2.4.
|
9
|
+
activemodel (5.2.4.3)
|
10
|
+
activesupport (= 5.2.4.3)
|
11
|
+
activerecord (5.2.4.3)
|
12
|
+
activemodel (= 5.2.4.3)
|
13
|
+
activesupport (= 5.2.4.3)
|
14
14
|
arel (>= 9.0)
|
15
|
-
activesupport (5.2.4.
|
15
|
+
activesupport (5.2.4.3)
|
16
16
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
17
|
i18n (>= 0.7, < 2)
|
18
18
|
minitest (~> 5.1)
|
19
19
|
tzinfo (~> 1.1)
|
20
20
|
arel (9.0.0)
|
21
|
-
concurrent-ruby (1.1.
|
21
|
+
concurrent-ruby (1.1.6)
|
22
22
|
contracts (0.16.0)
|
23
23
|
contracts-gen (0.1.1)
|
24
24
|
contracts (~> 0.16.0)
|
@@ -32,8 +32,8 @@ GEM
|
|
32
32
|
regexp-examples (~> 1.5.0)
|
33
33
|
i18n (1.8.2)
|
34
34
|
concurrent-ruby (~> 1.0)
|
35
|
-
minitest (5.14.
|
36
|
-
rake (
|
35
|
+
minitest (5.14.1)
|
36
|
+
rake (13.0.1)
|
37
37
|
regexp-examples (1.5.1)
|
38
38
|
rspec (3.9.0)
|
39
39
|
rspec-core (~> 3.9.0)
|
@@ -50,19 +50,20 @@ GEM
|
|
50
50
|
rspec-support (3.9.2)
|
51
51
|
sqlite3 (1.4.2)
|
52
52
|
thread_safe (0.3.6)
|
53
|
-
tzinfo (1.2.
|
53
|
+
tzinfo (1.2.7)
|
54
54
|
thread_safe (~> 0.1)
|
55
55
|
|
56
56
|
PLATFORMS
|
57
57
|
ruby
|
58
58
|
|
59
59
|
DEPENDENCIES
|
60
|
-
activerecord (
|
60
|
+
activerecord (>= 5.2.4.3, < 6)
|
61
61
|
activerecord-setops!
|
62
|
+
activesupport (>= 5.2.4.3, < 6)
|
62
63
|
bundler (~> 1.17)
|
63
64
|
contracts-gen (~> 0.1.1)
|
64
65
|
gen-test (~> 0.1.1)
|
65
|
-
rake (~>
|
66
|
+
rake (~> 13.0)
|
66
67
|
rspec (~> 3.0)
|
67
68
|
sqlite3 (~> 1.4.2)
|
68
69
|
|
data/README.md
CHANGED
@@ -1,12 +1,26 @@
|
|
1
|
+

|
2
|
+
[](https://badge.fury.io/rb/activerecord-setops)
|
3
|
+
|
1
4
|
# ActiveRecord::Setops
|
2
5
|
|
3
6
|
Union, Intersect, and Difference set operations for ActiveRecord (also, SQL's UnionAll).
|
4
7
|
Has only been tested with Rails 5.
|
5
8
|
|
9
|
+
# Synopsis
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
class Student < ActiveRecord::Base; end
|
13
|
+
class Employee < ActiveRecord::Base; end
|
14
|
+
|
15
|
+
(Student.select(:name, :birth_date) | Employee.select(:name, :birth_date)).where("name like John%")
|
16
|
+
```
|
17
|
+
|
6
18
|
# Why?
|
7
19
|
|
8
|
-
Joins can be difficult to reason about in Arel (
|
9
|
-
with set operations which are much
|
20
|
+
Joins can be difficult to reason about in Arel (and SQL for that matter). Many joins can be replaced
|
21
|
+
with set operations which are much simpler beasts, may offer performance gains, and have consistent
|
22
|
+
mathematical properties. But these operations while present in Arel are missing in ActiveRecord. This
|
23
|
+
module attempts to correct this lack.
|
10
24
|
|
11
25
|
# Installation
|
12
26
|
|
@@ -24,16 +38,8 @@ Or install it yourself as:
|
|
24
38
|
|
25
39
|
$ gem install activerecord-setops
|
26
40
|
|
27
|
-
# Synopsis
|
28
|
-
|
29
|
-
```ruby
|
30
|
-
class Student < ActiveRecord::Base; end
|
31
|
-
class Employee < ActiveRecord::Base; end
|
32
|
-
|
33
|
-
(Student.select(:name, :birth_date) | Employee.select(:name, :birth_date)).where("name like John%")
|
34
|
-
```
|
35
|
-
|
36
41
|
# See Also
|
37
42
|
|
38
43
|
- [Sequel](http://sequel.jeremyevans.net)
|
39
44
|
- [SQL Set Operations](https://en.wikipedia.org/wiki/Set_operations_(SQL))
|
45
|
+
- [active_record_union](https://github.com/brianhempel/active_record_union)
|
data/activerecord-setops.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.email = ["contact@delonnewman.name"]
|
10
10
|
|
11
11
|
spec.summary = %q{Set operations for ActiveRecord}
|
12
|
-
spec.description = %q{Union,
|
12
|
+
spec.description = %q{Union, Intersection, and Difference operations for ActiveRecord}
|
13
13
|
spec.homepage = "https://github.com/delonnewman/activerecord-setops#readme"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.metadata["homepage_uri"] = spec.homepage
|
22
22
|
spec.metadata["source_code_uri"] = "https://github.com/delonnewman/activerecord-setops"
|
23
23
|
spec.metadata["changelog_uri"] = "https://github.com/delonnewman/activerecord-setops#changelog"
|
24
|
+
spec.metadata["documentation_uri"] = 'https://www.rubydoc.info/gems/activerecord-setops'
|
24
25
|
else
|
25
26
|
raise "RubyGems 2.0 or newer is required to protect against " \
|
26
27
|
"public gem pushes."
|
@@ -36,10 +37,11 @@ Gem::Specification.new do |spec|
|
|
36
37
|
spec.require_paths = ["lib"]
|
37
38
|
|
38
39
|
spec.add_development_dependency "bundler", "~> 1.17"
|
39
|
-
spec.add_development_dependency "rake", "~>
|
40
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
40
41
|
spec.add_development_dependency "rspec", "~> 3.0"
|
41
42
|
spec.add_development_dependency "gen-test", "~> 0.1.1"
|
42
43
|
spec.add_development_dependency "contracts-gen", "~> 0.1.1"
|
43
|
-
spec.add_development_dependency "activerecord", "
|
44
|
+
spec.add_development_dependency "activerecord", [">= 5.2.4.3", "< 6"]
|
45
|
+
spec.add_development_dependency "activesupport", [">= 5.2.4.3", "< 6"]
|
44
46
|
spec.add_development_dependency "sqlite3", "~> 1.4.2"
|
45
47
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require_relative 'active_record/setops'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-setops
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Delon Newman
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '13.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,16 +84,42 @@ dependencies:
|
|
84
84
|
name: activerecord
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 5.2.4.3
|
90
|
+
- - "<"
|
88
91
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
92
|
+
version: '6'
|
90
93
|
type: :development
|
91
94
|
prerelease: false
|
92
95
|
version_requirements: !ruby/object:Gem::Requirement
|
93
96
|
requirements:
|
94
|
-
- - "
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 5.2.4.3
|
100
|
+
- - "<"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '6'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: activesupport
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 5.2.4.3
|
110
|
+
- - "<"
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '6'
|
113
|
+
type: :development
|
114
|
+
prerelease: false
|
115
|
+
version_requirements: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: 5.2.4.3
|
120
|
+
- - "<"
|
95
121
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
122
|
+
version: '6'
|
97
123
|
- !ruby/object:Gem::Dependency
|
98
124
|
name: sqlite3
|
99
125
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,7 +134,7 @@ dependencies:
|
|
108
134
|
- - "~>"
|
109
135
|
- !ruby/object:Gem::Version
|
110
136
|
version: 1.4.2
|
111
|
-
description: Union,
|
137
|
+
description: Union, Intersection, and Difference operations for ActiveRecord
|
112
138
|
email:
|
113
139
|
- contact@delonnewman.name
|
114
140
|
executables: []
|
@@ -118,6 +144,7 @@ files:
|
|
118
144
|
- ".github/workflows/ruby.yml"
|
119
145
|
- ".gitignore"
|
120
146
|
- ".rspec"
|
147
|
+
- CHANGELOG.md
|
121
148
|
- Gemfile
|
122
149
|
- Gemfile.lock
|
123
150
|
- LICENSE.txt
|
@@ -126,6 +153,7 @@ files:
|
|
126
153
|
- activerecord-setops.gemspec
|
127
154
|
- lib/active_record/setops.rb
|
128
155
|
- lib/active_record/setops/version.rb
|
156
|
+
- lib/activerecord-setops.rb
|
129
157
|
homepage: https://github.com/delonnewman/activerecord-setops#readme
|
130
158
|
licenses:
|
131
159
|
- MIT
|
@@ -134,7 +162,8 @@ metadata:
|
|
134
162
|
homepage_uri: https://github.com/delonnewman/activerecord-setops#readme
|
135
163
|
source_code_uri: https://github.com/delonnewman/activerecord-setops
|
136
164
|
changelog_uri: https://github.com/delonnewman/activerecord-setops#changelog
|
137
|
-
|
165
|
+
documentation_uri: https://www.rubydoc.info/gems/activerecord-setops
|
166
|
+
post_install_message:
|
138
167
|
rdoc_options: []
|
139
168
|
require_paths:
|
140
169
|
- lib
|
@@ -150,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
179
|
version: '0'
|
151
180
|
requirements: []
|
152
181
|
rubygems_version: 3.0.6
|
153
|
-
signing_key:
|
182
|
+
signing_key:
|
154
183
|
specification_version: 4
|
155
184
|
summary: Set operations for ActiveRecord
|
156
185
|
test_files: []
|