eager_group 0.10.0 → 0.11.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/.github/workflows/main.yml +31 -10
- data/.gitignore +2 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile.rails-7.0 +6 -0
- data/Gemfile.rails-7.1 +6 -0
- data/Gemfile.rails-7.2 +6 -0
- data/Gemfile.rails-8.0 +6 -0
- data/Gemfile.rails-8.1 +6 -0
- data/README.md +5 -4
- data/eager_group.gemspec +5 -2
- data/lib/eager_group/version.rb +1 -1
- metadata +20 -13
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bedabe6da7cfa46fbfbdecf1d2cc63a40f2d820fc5e9c65557a84d1ab4078495
|
|
4
|
+
data.tar.gz: 1f3e1ce3e020df317036605a553a046f13f17cc614f9e30425676157904de6bb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c591075a2549089e129caf73981483963cf93685485e7bd6903a6e6f692da0264405025187ddcf7ab4fe19f347be5fa0d132108b43c72c3156391a44d936c014
|
|
7
|
+
data.tar.gz: b10afd48502166c90dfe32abad7456dce45041a9e3b9412335696e849f5fa0ebe4af85d2e2489ed227e506de06b644b8f0dabd0789f3af42b7c09210689fd414
|
data/.github/workflows/main.yml
CHANGED
|
@@ -1,18 +1,39 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
2
3
|
on:
|
|
3
4
|
push:
|
|
4
5
|
branches:
|
|
5
6
|
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
|
|
6
11
|
jobs:
|
|
7
12
|
test:
|
|
8
|
-
name:
|
|
13
|
+
name: Ruby ${{ matrix.ruby }} / ${{ matrix.gemfile }}
|
|
9
14
|
runs-on: ubuntu-latest
|
|
15
|
+
strategy:
|
|
16
|
+
fail-fast: false
|
|
17
|
+
matrix:
|
|
18
|
+
ruby:
|
|
19
|
+
- '3.2'
|
|
20
|
+
- '3.3'
|
|
21
|
+
- '3.4'
|
|
22
|
+
- '4.0'
|
|
23
|
+
gemfile:
|
|
24
|
+
- Gemfile.rails-7.0
|
|
25
|
+
- Gemfile.rails-7.1
|
|
26
|
+
- Gemfile.rails-7.2
|
|
27
|
+
- Gemfile.rails-8.0
|
|
28
|
+
- Gemfile.rails-8.1
|
|
29
|
+
env:
|
|
30
|
+
BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }}
|
|
10
31
|
steps:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
32
|
+
- uses: actions/checkout@v5
|
|
33
|
+
- name: Set up Ruby
|
|
34
|
+
uses: ruby/setup-ruby@v1
|
|
35
|
+
with:
|
|
36
|
+
ruby-version: ${{ matrix.ruby }}
|
|
37
|
+
bundler-cache: true
|
|
38
|
+
- name: Run tests
|
|
39
|
+
run: bundle exec rspec
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Next Release
|
|
2
2
|
|
|
3
|
+
## 0.11.0 (11/06/2026)
|
|
4
|
+
|
|
5
|
+
* Drop Ruby 3.1 and Rails 4.x, 5.x, 6.x support
|
|
6
|
+
* Support Ruby 3.2, 3.3, 3.4, 4.0 and Rails 7.x, 8.x
|
|
7
|
+
* Replace Travis CI with GitHub Actions
|
|
8
|
+
|
|
3
9
|
## 0.10.0 (12/28/2022)
|
|
4
10
|
|
|
5
11
|
* Add STI support, use `class_attribute` to prevent subclasses affect each other
|
data/Gemfile.rails-7.0
ADDED
data/Gemfile.rails-7.1
ADDED
data/Gemfile.rails-7.2
ADDED
data/Gemfile.rails-8.0
ADDED
data/Gemfile.rails-8.1
ADDED
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# EagerGroup
|
|
2
2
|
|
|
3
|
-
[](https://github.com/flyerhzm/eager_group/actions/workflows/main.yml)
|
|
4
4
|
[](https://awesomecode.io/repos/flyerhzm/eager_group)
|
|
6
6
|
|
|
@@ -38,7 +38,7 @@ SELECT "posts".* FROM "posts";
|
|
|
38
38
|
SELECT AVG("comments"."rating") AS average_comments_rating, post_id AS post_id FROM "comments" WHERE "comments"."post_id" IN (1, 2, 3) GROUP BY post_id;
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
It supports
|
|
41
|
+
It supports Ruby 3.2, 3.3, 3.4 and 4.0, and Rails 7.x and 8.x
|
|
42
42
|
|
|
43
43
|
## Installation
|
|
44
44
|
|
|
@@ -70,7 +70,7 @@ class Post < ActiveRecord::Base
|
|
|
70
70
|
has_many :comments
|
|
71
71
|
|
|
72
72
|
define_eager_group :comments_average_rating, :comments, :average, :rating
|
|
73
|
-
define_eager_group :approved_comments_count, :comments, :count,
|
|
73
|
+
define_eager_group :approved_comments_count, :comments, :count, :all, -> { approved }
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
class Comment < ActiveRecord::Base
|
|
@@ -90,7 +90,8 @@ result.
|
|
|
90
90
|
`count`, `maximum`, `minimum`, `sum`, I define 2 additional aggregate
|
|
91
91
|
function `first_object` and `last_object` to eager load first and last
|
|
92
92
|
association objects.
|
|
93
|
-
* `column_name`, aggregate column name, it can be
|
|
93
|
+
* `column_name`, aggregate column name, it can be `:all` (from rails 8) or
|
|
94
|
+
`:*` for `count`.
|
|
94
95
|
* `scope`, scope is optional, it's used to filter data for aggregation.
|
|
95
96
|
|
|
96
97
|
Then you can use `eager_group` to fix n+1 aggregate sql functions
|
data/eager_group.gemspec
CHANGED
|
@@ -16,17 +16,20 @@ Gem::Specification.new do |spec|
|
|
|
16
16
|
|
|
17
17
|
spec.license = 'MIT'
|
|
18
18
|
|
|
19
|
+
spec.required_ruby_version = '>= 3.2.0'
|
|
20
|
+
|
|
19
21
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
20
22
|
spec.bindir = 'exe'
|
|
21
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
22
24
|
spec.require_paths = ['lib']
|
|
23
25
|
|
|
24
|
-
spec.
|
|
26
|
+
spec.add_dependency 'activerecord', '>= 7.0', '< 9.0'
|
|
27
|
+
|
|
25
28
|
spec.add_development_dependency 'activerecord-import'
|
|
26
29
|
spec.add_development_dependency 'activesupport'
|
|
27
30
|
spec.add_development_dependency 'benchmark-ips'
|
|
28
31
|
spec.add_development_dependency 'bundler'
|
|
29
|
-
spec.add_development_dependency 'rake', '~>
|
|
32
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
|
30
33
|
spec.add_development_dependency 'rspec', '~> 3.3'
|
|
31
34
|
spec.add_development_dependency 'sqlite3'
|
|
32
35
|
spec.add_development_dependency 'pry'
|
data/lib/eager_group/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: eager_group
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.11.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Richard Huang
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: activerecord
|
|
@@ -16,14 +15,20 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '0'
|
|
20
|
-
|
|
18
|
+
version: '7.0'
|
|
19
|
+
- - "<"
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '9.0'
|
|
22
|
+
type: :runtime
|
|
21
23
|
prerelease: false
|
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
25
|
requirements:
|
|
24
26
|
- - ">="
|
|
25
27
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '0'
|
|
28
|
+
version: '7.0'
|
|
29
|
+
- - "<"
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: '9.0'
|
|
27
32
|
- !ruby/object:Gem::Dependency
|
|
28
33
|
name: activerecord-import
|
|
29
34
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -86,14 +91,14 @@ dependencies:
|
|
|
86
91
|
requirements:
|
|
87
92
|
- - "~>"
|
|
88
93
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: '
|
|
94
|
+
version: '13.0'
|
|
90
95
|
type: :development
|
|
91
96
|
prerelease: false
|
|
92
97
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
98
|
requirements:
|
|
94
99
|
- - "~>"
|
|
95
100
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: '
|
|
101
|
+
version: '13.0'
|
|
97
102
|
- !ruby/object:Gem::Dependency
|
|
98
103
|
name: rspec
|
|
99
104
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -146,9 +151,13 @@ files:
|
|
|
146
151
|
- ".github/workflows/main.yml"
|
|
147
152
|
- ".gitignore"
|
|
148
153
|
- ".rspec"
|
|
149
|
-
- ".travis.yml"
|
|
150
154
|
- CHANGELOG.md
|
|
151
155
|
- Gemfile
|
|
156
|
+
- Gemfile.rails-7.0
|
|
157
|
+
- Gemfile.rails-7.1
|
|
158
|
+
- Gemfile.rails-7.2
|
|
159
|
+
- Gemfile.rails-8.0
|
|
160
|
+
- Gemfile.rails-8.1
|
|
152
161
|
- MIT-LICENSE
|
|
153
162
|
- README.md
|
|
154
163
|
- Rakefile
|
|
@@ -170,7 +179,6 @@ homepage: https://github.com/flyerhzm/eager_group
|
|
|
170
179
|
licenses:
|
|
171
180
|
- MIT
|
|
172
181
|
metadata: {}
|
|
173
|
-
post_install_message:
|
|
174
182
|
rdoc_options: []
|
|
175
183
|
require_paths:
|
|
176
184
|
- lib
|
|
@@ -178,15 +186,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
178
186
|
requirements:
|
|
179
187
|
- - ">="
|
|
180
188
|
- !ruby/object:Gem::Version
|
|
181
|
-
version:
|
|
189
|
+
version: 3.2.0
|
|
182
190
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
191
|
requirements:
|
|
184
192
|
- - ">="
|
|
185
193
|
- !ruby/object:Gem::Version
|
|
186
194
|
version: '0'
|
|
187
195
|
requirements: []
|
|
188
|
-
rubygems_version:
|
|
189
|
-
signing_key:
|
|
196
|
+
rubygems_version: 4.0.20
|
|
190
197
|
specification_version: 4
|
|
191
198
|
summary: Fix n+1 aggregate sql functions
|
|
192
199
|
test_files: []
|