pluck_in_batches 0.2.0 → 0.3.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/CHANGELOG.md +8 -0
- data/README.md +5 -0
- data/lib/pluck_in_batches/iterator.rb +8 -1
- data/lib/pluck_in_batches/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c30844758feb52e696cbde2155d47204b537201975ec2a7857db5400ca982c9
|
4
|
+
data.tar.gz: 69c73ac8249b95a2b9d8e4542396ee7969be7d28aa3e2277b06f5ed652eedc87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e49e5929fefd29e092c0dc5da7f051fd735dd2175a347dfa0a34af274c105b3dd5c4897f90b350ad2ac982b260f4cfbe64d2504878f5f554036bb7466210579
|
7
|
+
data.tar.gz: a1ba0c9f0a426c0fd6cd73985af955cad50dbca4c7777049b94cbf85f655721edffeb13dc4bc71d8c8bc78e357ff22b620b96b7718a64c59a8fb091e3029164d
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
## master (unreleased)
|
2
2
|
|
3
|
+
## 0.3.0 (2024-11-03)
|
4
|
+
|
5
|
+
- Support plucking custom Arel columns
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
User.pluck_in_batches(:id, Arel.sql("json_extract(users.metadata, '$.rank')"))
|
9
|
+
```
|
10
|
+
|
3
11
|
## 0.2.0 (2023-07-24)
|
4
12
|
|
5
13
|
- Support specifying per cursor column ordering when batching
|
data/README.md
CHANGED
@@ -91,6 +91,11 @@ User.pluck_in_batches(:name, :email).with_index do |group, index|
|
|
91
91
|
jobs = group.map { |name, email| PartyReminderJob.new(name, email) }
|
92
92
|
ActiveJob.perform_all_later(jobs)
|
93
93
|
end
|
94
|
+
|
95
|
+
# Custom arel column
|
96
|
+
User.pluck_in_batches(:id, Arel.sql("json_extract(users.metadata, '$.rank')")).with_index do |group, index|
|
97
|
+
# ...
|
98
|
+
end
|
94
99
|
```
|
95
100
|
|
96
101
|
Both methods support the following configuration options:
|
@@ -35,7 +35,14 @@ module PluckInBatches
|
|
35
35
|
raise ArgumentError, ":order must be :asc or :desc or an array consisting of :asc or :desc, got #{order.inspect}"
|
36
36
|
end
|
37
37
|
|
38
|
-
pluck_columns = columns.map
|
38
|
+
pluck_columns = columns.map do |column|
|
39
|
+
if Arel.arel_node?(column)
|
40
|
+
column
|
41
|
+
else
|
42
|
+
column.to_s
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
39
46
|
cursor_columns = Array(cursor_column).map(&:to_s)
|
40
47
|
cursor_column_indexes = cursor_column_indexes(pluck_columns, cursor_columns)
|
41
48
|
missing_cursor_columns = cursor_column_indexes.count(&:nil?)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pluck_in_batches
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fatkodima
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -60,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
requirements: []
|
63
|
-
rubygems_version: 3.4.
|
63
|
+
rubygems_version: 3.4.19
|
64
64
|
signing_key:
|
65
65
|
specification_version: 4
|
66
66
|
summary: A faster alternative to the custom use of `in_batches` with `pluck`.
|