cursor_pager 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +8 -1
- data/Gemfile.lock +1 -1
- data/gemfiles/activerecord_5.2.gemfile.lock +36 -33
- data/gemfiles/activerecord_6.0.gemfile.lock +38 -35
- data/lib/cursor_pager/page.rb +13 -4
- data/lib/cursor_pager/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: 5a61d376be58b8a79f723f16b7a95af05e2204bb3086465518fc0bd33bc118f3
|
4
|
+
data.tar.gz: ee0de4fa845db9c541453d6a269c1890f4b1dad8713857015ce5aa75d30b5a15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25b37f735e9a74ec8ac7b2ba6bbc25620bf10a35ecfc67bb12df46fca01fc39708dbd6455eccf06de0097b5da981a15f8c26dac7018f4bdd1b7d35e264edd23a
|
7
|
+
data.tar.gz: 5bccd36ef0e162445bf633acc7f046ecd423a7e310e02f20362e30d86934054a107506957f4d09d9f07a65e63780ea33fa3a2652879c9cbfbd5acde9fbe14717
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.7.
|
1
|
+
2.7.2
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [0.2.3] - 2020-11-23
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
|
14
|
+
* Fix using cursors with preloaded or eager loaded associations #13
|
15
|
+
|
10
16
|
## [0.2.2] - 2020-09-29
|
11
17
|
|
12
18
|
### Fixed
|
@@ -33,7 +39,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
33
39
|
* First implementation of cursor-pased pagination #2
|
34
40
|
* Configurable cursor encoder #3
|
35
41
|
|
36
|
-
[Unreleased]: https://github.com/check24-profis/shared-cursor-pager/compare/v0.2.
|
42
|
+
[Unreleased]: https://github.com/check24-profis/shared-cursor-pager/compare/v0.2.3...HEAD
|
43
|
+
[0.2.3]: https://github.com/check24-profis/shared-cursor-pager/compare/v0.2.2...v0.2.3
|
37
44
|
[0.2.2]: https://github.com/check24-profis/shared-cursor-pager/compare/v0.2.1...v0.2.2
|
38
45
|
[0.2.1]: https://github.com/check24-profis/shared-cursor-pager/compare/v0.2.0...v0.2.1
|
39
46
|
[0.2.0]: https://github.com/check24-profis/shared-cursor-pager/compare/v0.1.0...v0.2.0
|
data/Gemfile.lock
CHANGED
@@ -1,71 +1,74 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
cursor_pager (0.
|
4
|
+
cursor_pager (0.2.3)
|
5
5
|
activerecord (>= 5.2.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activemodel (5.2.4.
|
11
|
-
activesupport (= 5.2.4.
|
12
|
-
activerecord (5.2.4.
|
13
|
-
activemodel (= 5.2.4.
|
14
|
-
activesupport (= 5.2.4.
|
10
|
+
activemodel (5.2.4.4)
|
11
|
+
activesupport (= 5.2.4.4)
|
12
|
+
activerecord (5.2.4.4)
|
13
|
+
activemodel (= 5.2.4.4)
|
14
|
+
activesupport (= 5.2.4.4)
|
15
15
|
arel (>= 9.0)
|
16
|
-
activesupport (5.2.4.
|
16
|
+
activesupport (5.2.4.4)
|
17
17
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
18
|
i18n (>= 0.7, < 2)
|
19
19
|
minitest (~> 5.1)
|
20
20
|
tzinfo (~> 1.1)
|
21
|
-
appraisal (2.
|
21
|
+
appraisal (2.3.0)
|
22
22
|
bundler
|
23
23
|
rake
|
24
24
|
thor (>= 0.14.0)
|
25
25
|
arel (9.0.0)
|
26
|
-
ast (2.4.
|
27
|
-
concurrent-ruby (1.1.
|
28
|
-
database_cleaner (1.8.
|
26
|
+
ast (2.4.1)
|
27
|
+
concurrent-ruby (1.1.7)
|
28
|
+
database_cleaner (1.8.5)
|
29
29
|
database_cleaner-active_record (1.8.0)
|
30
30
|
activerecord
|
31
31
|
database_cleaner (~> 1.8.0)
|
32
|
-
diff-lcs (1.
|
33
|
-
i18n (1.8.
|
32
|
+
diff-lcs (1.4.4)
|
33
|
+
i18n (1.8.5)
|
34
34
|
concurrent-ruby (~> 1.0)
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
ast (~> 2.4.0)
|
35
|
+
minitest (5.14.2)
|
36
|
+
parallel (1.20.1)
|
37
|
+
parser (2.7.2.0)
|
38
|
+
ast (~> 2.4.1)
|
40
39
|
pg (1.2.3)
|
41
40
|
rainbow (3.0.0)
|
42
41
|
rake (12.3.3)
|
42
|
+
regexp_parser (1.8.2)
|
43
43
|
rexml (3.2.4)
|
44
|
-
rspec (3.
|
45
|
-
rspec-core (~> 3.
|
46
|
-
rspec-expectations (~> 3.
|
47
|
-
rspec-mocks (~> 3.
|
48
|
-
rspec-core (3.
|
49
|
-
rspec-support (~> 3.
|
50
|
-
rspec-expectations (3.
|
44
|
+
rspec (3.10.0)
|
45
|
+
rspec-core (~> 3.10.0)
|
46
|
+
rspec-expectations (~> 3.10.0)
|
47
|
+
rspec-mocks (~> 3.10.0)
|
48
|
+
rspec-core (3.10.0)
|
49
|
+
rspec-support (~> 3.10.0)
|
50
|
+
rspec-expectations (3.10.0)
|
51
51
|
diff-lcs (>= 1.2.0, < 2.0)
|
52
|
-
rspec-support (~> 3.
|
53
|
-
rspec-mocks (3.
|
52
|
+
rspec-support (~> 3.10.0)
|
53
|
+
rspec-mocks (3.10.0)
|
54
54
|
diff-lcs (>= 1.2.0, < 2.0)
|
55
|
-
rspec-support (~> 3.
|
56
|
-
rspec-support (3.
|
57
|
-
rubocop (
|
58
|
-
jaro_winkler (~> 1.5.1)
|
55
|
+
rspec-support (~> 3.10.0)
|
56
|
+
rspec-support (3.10.0)
|
57
|
+
rubocop (1.4.0)
|
59
58
|
parallel (~> 1.10)
|
60
|
-
parser (>= 2.7.
|
59
|
+
parser (>= 2.7.1.5)
|
61
60
|
rainbow (>= 2.2.2, < 4.0)
|
61
|
+
regexp_parser (>= 1.8)
|
62
62
|
rexml
|
63
|
+
rubocop-ast (>= 1.1.1)
|
63
64
|
ruby-progressbar (~> 1.7)
|
64
65
|
unicode-display_width (>= 1.4.0, < 2.0)
|
66
|
+
rubocop-ast (1.1.1)
|
67
|
+
parser (>= 2.7.1.5)
|
65
68
|
ruby-progressbar (1.10.1)
|
66
69
|
thor (1.0.1)
|
67
70
|
thread_safe (0.3.6)
|
68
|
-
tzinfo (1.2.
|
71
|
+
tzinfo (1.2.8)
|
69
72
|
thread_safe (~> 0.1)
|
70
73
|
unicode-display_width (1.7.0)
|
71
74
|
|
@@ -1,73 +1,76 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
cursor_pager (0.
|
4
|
+
cursor_pager (0.2.3)
|
5
5
|
activerecord (>= 5.2.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activemodel (6.0.
|
11
|
-
activesupport (= 6.0.
|
12
|
-
activerecord (6.0.
|
13
|
-
activemodel (= 6.0.
|
14
|
-
activesupport (= 6.0.
|
15
|
-
activesupport (6.0.
|
10
|
+
activemodel (6.0.3.4)
|
11
|
+
activesupport (= 6.0.3.4)
|
12
|
+
activerecord (6.0.3.4)
|
13
|
+
activemodel (= 6.0.3.4)
|
14
|
+
activesupport (= 6.0.3.4)
|
15
|
+
activesupport (6.0.3.4)
|
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
|
-
zeitwerk (~> 2.2)
|
21
|
-
appraisal (2.
|
20
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
21
|
+
appraisal (2.3.0)
|
22
22
|
bundler
|
23
23
|
rake
|
24
24
|
thor (>= 0.14.0)
|
25
|
-
ast (2.4.
|
26
|
-
concurrent-ruby (1.1.
|
27
|
-
database_cleaner (1.8.
|
25
|
+
ast (2.4.1)
|
26
|
+
concurrent-ruby (1.1.7)
|
27
|
+
database_cleaner (1.8.5)
|
28
28
|
database_cleaner-active_record (1.8.0)
|
29
29
|
activerecord
|
30
30
|
database_cleaner (~> 1.8.0)
|
31
|
-
diff-lcs (1.
|
32
|
-
i18n (1.8.
|
31
|
+
diff-lcs (1.4.4)
|
32
|
+
i18n (1.8.5)
|
33
33
|
concurrent-ruby (~> 1.0)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
ast (~> 2.4.0)
|
34
|
+
minitest (5.14.2)
|
35
|
+
parallel (1.20.1)
|
36
|
+
parser (2.7.2.0)
|
37
|
+
ast (~> 2.4.1)
|
39
38
|
pg (1.2.3)
|
40
39
|
rainbow (3.0.0)
|
41
40
|
rake (12.3.3)
|
41
|
+
regexp_parser (1.8.2)
|
42
42
|
rexml (3.2.4)
|
43
|
-
rspec (3.
|
44
|
-
rspec-core (~> 3.
|
45
|
-
rspec-expectations (~> 3.
|
46
|
-
rspec-mocks (~> 3.
|
47
|
-
rspec-core (3.
|
48
|
-
rspec-support (~> 3.
|
49
|
-
rspec-expectations (3.
|
43
|
+
rspec (3.10.0)
|
44
|
+
rspec-core (~> 3.10.0)
|
45
|
+
rspec-expectations (~> 3.10.0)
|
46
|
+
rspec-mocks (~> 3.10.0)
|
47
|
+
rspec-core (3.10.0)
|
48
|
+
rspec-support (~> 3.10.0)
|
49
|
+
rspec-expectations (3.10.0)
|
50
50
|
diff-lcs (>= 1.2.0, < 2.0)
|
51
|
-
rspec-support (~> 3.
|
52
|
-
rspec-mocks (3.
|
51
|
+
rspec-support (~> 3.10.0)
|
52
|
+
rspec-mocks (3.10.0)
|
53
53
|
diff-lcs (>= 1.2.0, < 2.0)
|
54
|
-
rspec-support (~> 3.
|
55
|
-
rspec-support (3.
|
56
|
-
rubocop (
|
57
|
-
jaro_winkler (~> 1.5.1)
|
54
|
+
rspec-support (~> 3.10.0)
|
55
|
+
rspec-support (3.10.0)
|
56
|
+
rubocop (1.4.0)
|
58
57
|
parallel (~> 1.10)
|
59
|
-
parser (>= 2.7.
|
58
|
+
parser (>= 2.7.1.5)
|
60
59
|
rainbow (>= 2.2.2, < 4.0)
|
60
|
+
regexp_parser (>= 1.8)
|
61
61
|
rexml
|
62
|
+
rubocop-ast (>= 1.1.1)
|
62
63
|
ruby-progressbar (~> 1.7)
|
63
64
|
unicode-display_width (>= 1.4.0, < 2.0)
|
65
|
+
rubocop-ast (1.1.1)
|
66
|
+
parser (>= 2.7.1.5)
|
64
67
|
ruby-progressbar (1.10.1)
|
65
68
|
thor (1.0.1)
|
66
69
|
thread_safe (0.3.6)
|
67
|
-
tzinfo (1.2.
|
70
|
+
tzinfo (1.2.8)
|
68
71
|
thread_safe (~> 0.1)
|
69
72
|
unicode-display_width (1.7.0)
|
70
|
-
zeitwerk (2.
|
73
|
+
zeitwerk (2.4.1)
|
71
74
|
|
72
75
|
PLATFORMS
|
73
76
|
ruby
|
data/lib/cursor_pager/page.rb
CHANGED
@@ -148,14 +148,23 @@ module CursorPager
|
|
148
148
|
end
|
149
149
|
|
150
150
|
def limit_value_for(cursor)
|
151
|
-
|
152
|
-
|
153
|
-
selects = order_values.map(&:select_string)
|
154
|
-
item = ordered_relation.where(id: id).select(selects).first
|
151
|
+
item = limit_item_for(cursor)
|
155
152
|
|
156
153
|
raise CursorNotFoundError, cursor if item.blank?
|
157
154
|
|
158
155
|
order_values.map { |value| item[value.select_alias] }
|
159
156
|
end
|
157
|
+
|
158
|
+
def limit_item_for(cursor)
|
159
|
+
id = encoder.decode(cursor)
|
160
|
+
|
161
|
+
selects = order_values.map(&:select_string)
|
162
|
+
ordered_relation_copy = ordered_relation.dup
|
163
|
+
|
164
|
+
ordered_relation_copy.preload_values = []
|
165
|
+
ordered_relation_copy.eager_load_values = []
|
166
|
+
ordered_relation_copy
|
167
|
+
.unscope(:includes).where(id: id).select(selects).first
|
168
|
+
end
|
160
169
|
end
|
161
170
|
end
|
data/lib/cursor_pager/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cursor_pager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bastian Bartmann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|
91
|
-
rubygems_version: 3.1.
|
91
|
+
rubygems_version: 3.1.4
|
92
92
|
signing_key:
|
93
93
|
specification_version: 4
|
94
94
|
summary: Cursor-based pagination for ActiveRecord relations.
|