cursor_pager 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +12 -6
- data/.ruby-version +1 -1
- data/Appraisals +4 -0
- data/CHANGELOG.md +37 -3
- data/Gemfile.lock +51 -49
- data/README.md +2 -2
- data/cursor_pager.gemspec +2 -2
- data/gemfiles/activerecord_5.2.gemfile.lock +37 -34
- data/gemfiles/activerecord_6.0.gemfile.lock +39 -36
- data/gemfiles/activerecord_6.1.gemfile +13 -0
- data/gemfiles/activerecord_6.1.gemfile.lock +89 -0
- data/lib/cursor_pager/cursor_not_found_error.rb +4 -0
- data/lib/cursor_pager/page.rb +14 -5
- data/lib/cursor_pager/version.rb +1 -1
- metadata +13 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 481947bc305ba5c0952bd48e7a11cce97ef065d8c52eb8a17b911f936cc3bcb5
|
4
|
+
data.tar.gz: 072b3a752fd17c323595cb60282180c315008d84dd443938367b0cc1899bc8bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8afbe43e9f1585d5aa70dffcebcb87654975889f054c79d9dddd55b3cda410189a0cf121ae886e7bca9954f084457884edff4cc7e6537fe48c765447fc5eec9
|
7
|
+
data.tar.gz: 61742d6d1e3d1a45af9202578dda3ad290fb059259d02b091a4233dff0354024e0b1c99c88eb7076d235d2e6eac181d7ec9f0fbb6006288cbc472b6984843033
|
data/.github/workflows/ci.yml
CHANGED
@@ -2,17 +2,23 @@ name: CI
|
|
2
2
|
|
3
3
|
on:
|
4
4
|
push:
|
5
|
-
branches: [
|
5
|
+
branches: [main]
|
6
6
|
pull_request:
|
7
|
-
branches: [
|
7
|
+
branches: [main]
|
8
8
|
|
9
9
|
jobs:
|
10
10
|
test:
|
11
11
|
runs-on: ubuntu-latest
|
12
12
|
strategy:
|
13
|
+
fail-fast: false
|
13
14
|
matrix:
|
14
|
-
|
15
|
-
|
15
|
+
include:
|
16
|
+
- ruby-version: "2.6"
|
17
|
+
activerecord-version: "5.2"
|
18
|
+
- ruby-version: "2.7"
|
19
|
+
activerecord-version: "6.0"
|
20
|
+
- ruby-version: "3.0"
|
21
|
+
activerecord-version: "6.1"
|
16
22
|
|
17
23
|
services:
|
18
24
|
db:
|
@@ -31,9 +37,9 @@ jobs:
|
|
31
37
|
uses: actions/cache@v1
|
32
38
|
with:
|
33
39
|
path: vendor/bundle
|
34
|
-
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
40
|
+
key: ${{ runner.os }}-gems-${{ matrix.ruby-version }}-${{ hashFiles('**/Gemfile.lock') }}
|
35
41
|
restore-keys: |
|
36
|
-
${{ runner.os }}-gems-
|
42
|
+
${{ runner.os }}-gems-${{ matrix.ruby-version }}-
|
37
43
|
|
38
44
|
- name: Set up Ruby ${{ matrix.ruby-version }}
|
39
45
|
uses: ruby/setup-ruby@v1
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.7.
|
1
|
+
2.7.2
|
data/Appraisals
CHANGED
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [0.3.0] - 2021-06-11
|
11
|
+
### Added
|
12
|
+
|
13
|
+
* Add `cursor` attribute to `CursorNotFoundError`
|
14
|
+
|
15
|
+
## [0.2.4] - 2021-04-01
|
16
|
+
|
17
|
+
### Fixed
|
18
|
+
|
19
|
+
* Fix `Page#next_page?` when given a grouped relation #15
|
20
|
+
|
21
|
+
## [0.2.3] - 2020-11-23
|
22
|
+
|
23
|
+
### Fixed
|
24
|
+
|
25
|
+
* Fix using cursors with preloaded or eager loaded associations #13
|
26
|
+
|
27
|
+
## [0.2.2] - 2020-09-29
|
28
|
+
|
29
|
+
### Fixed
|
30
|
+
|
31
|
+
* Fix checking if the next page exists when a custom select is given #12
|
32
|
+
|
33
|
+
## [0.2.1] - 2020-05-13
|
34
|
+
|
35
|
+
### Fixed
|
36
|
+
|
37
|
+
* Fix fetching cursor values when relation has join and string order values #9
|
38
|
+
|
10
39
|
## [0.2.0] - 2020-04-23
|
11
40
|
|
12
41
|
### Added
|
@@ -21,6 +50,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
21
50
|
* First implementation of cursor-pased pagination #2
|
22
51
|
* Configurable cursor encoder #3
|
23
52
|
|
24
|
-
[Unreleased]: https://github.com/
|
25
|
-
[0.
|
26
|
-
[0.
|
53
|
+
[Unreleased]: https://github.com/check24-profis/shared-cursor-pager/compare/v0.3.0...HEAD
|
54
|
+
[0.3.0]: https://github.com/check24-profis/shared-cursor-pager/compare/v0.2.4...v0.3.0
|
55
|
+
[0.2.4]: https://github.com/check24-profis/shared-cursor-pager/compare/v0.2.3...v0.2.4
|
56
|
+
[0.2.3]: https://github.com/check24-profis/shared-cursor-pager/compare/v0.2.2...v0.2.3
|
57
|
+
[0.2.2]: https://github.com/check24-profis/shared-cursor-pager/compare/v0.2.1...v0.2.2
|
58
|
+
[0.2.1]: https://github.com/check24-profis/shared-cursor-pager/compare/v0.2.0...v0.2.1
|
59
|
+
[0.2.0]: https://github.com/check24-profis/shared-cursor-pager/compare/v0.1.0...v0.2.0
|
60
|
+
[0.1.0]: https://github.com/check24-profis/shared-cursor-pager/releases/tag/v0.1.0
|
data/Gemfile.lock
CHANGED
@@ -1,73 +1,75 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cursor_pager (0.
|
4
|
+
cursor_pager (0.3.0)
|
5
5
|
activerecord (>= 5.2.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activemodel (6.
|
11
|
-
activesupport (= 6.
|
12
|
-
activerecord (6.
|
13
|
-
activemodel (= 6.
|
14
|
-
activesupport (= 6.
|
15
|
-
activesupport (6.
|
10
|
+
activemodel (6.1.3.1)
|
11
|
+
activesupport (= 6.1.3.1)
|
12
|
+
activerecord (6.1.3.1)
|
13
|
+
activemodel (= 6.1.3.1)
|
14
|
+
activesupport (= 6.1.3.1)
|
15
|
+
activesupport (6.1.3.1)
|
16
16
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
|
-
i18n (>=
|
18
|
-
minitest (
|
19
|
-
tzinfo (~>
|
20
|
-
zeitwerk (~> 2.
|
21
|
-
appraisal (2.
|
17
|
+
i18n (>= 1.6, < 2)
|
18
|
+
minitest (>= 5.1)
|
19
|
+
tzinfo (~> 2.0)
|
20
|
+
zeitwerk (~> 2.3)
|
21
|
+
appraisal (2.4.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 (
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
diff-lcs (1.
|
32
|
-
i18n (1.8.
|
25
|
+
ast (2.4.2)
|
26
|
+
concurrent-ruby (1.1.8)
|
27
|
+
database_cleaner-active_record (2.0.0)
|
28
|
+
activerecord (>= 5.a)
|
29
|
+
database_cleaner-core (~> 2.0.0)
|
30
|
+
database_cleaner-core (2.0.1)
|
31
|
+
diff-lcs (1.4.4)
|
32
|
+
i18n (1.8.10)
|
33
33
|
concurrent-ruby (~> 1.0)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
ast (~> 2.4.0)
|
34
|
+
minitest (5.14.4)
|
35
|
+
parallel (1.20.1)
|
36
|
+
parser (3.0.0.0)
|
37
|
+
ast (~> 2.4.1)
|
39
38
|
pg (1.2.3)
|
40
39
|
rainbow (3.0.0)
|
41
40
|
rake (12.3.3)
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
rspec-
|
46
|
-
rspec-
|
47
|
-
|
48
|
-
|
49
|
-
|
41
|
+
regexp_parser (2.1.1)
|
42
|
+
rexml (3.2.5)
|
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.1)
|
48
|
+
rspec-support (~> 3.10.0)
|
49
|
+
rspec-expectations (3.10.1)
|
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.2)
|
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.2)
|
56
|
+
rubocop (1.12.0)
|
58
57
|
parallel (~> 1.10)
|
59
|
-
parser (>=
|
58
|
+
parser (>= 3.0.0.0)
|
60
59
|
rainbow (>= 2.2.2, < 4.0)
|
60
|
+
regexp_parser (>= 1.8, < 3.0)
|
61
61
|
rexml
|
62
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
62
63
|
ruby-progressbar (~> 1.7)
|
63
|
-
unicode-display_width (>= 1.4.0, <
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
64
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
65
|
+
rubocop-ast (1.4.1)
|
66
|
+
parser (>= 2.7.1.5)
|
67
|
+
ruby-progressbar (1.11.0)
|
68
|
+
thor (1.1.0)
|
69
|
+
tzinfo (2.0.4)
|
70
|
+
concurrent-ruby (~> 1.0)
|
71
|
+
unicode-display_width (2.0.0)
|
72
|
+
zeitwerk (2.4.2)
|
71
73
|
|
72
74
|
PLATFORMS
|
73
75
|
ruby
|
@@ -82,4 +84,4 @@ DEPENDENCIES
|
|
82
84
|
rubocop
|
83
85
|
|
84
86
|
BUNDLED WITH
|
85
|
-
2.
|
87
|
+
2.2.15
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# CursorPager
|
2
2
|
|
3
|
-
![build](https://github.com/
|
3
|
+
![build](https://github.com/check24-profis/shared-cursor-pager/workflows/CI/badge.svg) [![Gem Version](https://badge.fury.io/rb/cursor_pager.svg)](https://badge.fury.io/rb/cursor_pager)
|
4
4
|
|
5
5
|
A small and easy-to-use library that aims to make it easy to build Rails APIs
|
6
6
|
with cursor-based pagination (aka keyset pagination).
|
@@ -119,5 +119,5 @@ The gem is available as open source under the terms of the [MIT License].
|
|
119
119
|
|
120
120
|
[JSON API Cursor Pagination]: https://jsonapi.org/profiles/ethanresnick/cursor-pagination/
|
121
121
|
[Relay's GraphQL Cursor Connection]: https://relay.dev/graphql/connections.htm
|
122
|
-
[code of conduct]: https://github.com/
|
122
|
+
[code of conduct]: https://github.com/check24-profis/shared-cursor-pager/blob/main/CODE_OF_CONDUCT.md
|
123
123
|
[MIT License]: https://opensource.org/licenses/MIT
|
data/cursor_pager.gemspec
CHANGED
@@ -9,14 +9,14 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.email = ["bastian.bartmann@check24.de"]
|
10
10
|
|
11
11
|
spec.summary = "Cursor-based pagination for ActiveRecord relations."
|
12
|
-
spec.homepage = "https://github.com/
|
12
|
+
spec.homepage = "https://github.com/check24-profis/shared-cursor-pager"
|
13
13
|
spec.license = "MIT"
|
14
14
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
|
15
15
|
|
16
16
|
spec.metadata["homepage_uri"] = spec.homepage
|
17
17
|
spec.metadata["source_code_uri"] = spec.homepage
|
18
18
|
spec.metadata["changelog_uri"] =
|
19
|
-
"https://github.com/
|
19
|
+
"https://github.com/check24-profis/shared-cursor-pager/blob/main/CHANGELOG.md"
|
20
20
|
|
21
21
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
22
22
|
`git ls-files -z`
|
@@ -1,71 +1,74 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
cursor_pager (0.
|
4
|
+
cursor_pager (0.3.0)
|
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
|
|
@@ -83,4 +86,4 @@ DEPENDENCIES
|
|
83
86
|
rubocop
|
84
87
|
|
85
88
|
BUNDLED WITH
|
86
|
-
2.
|
89
|
+
2.2.15
|
@@ -1,73 +1,76 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
cursor_pager (0.
|
4
|
+
cursor_pager (0.3.0)
|
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
|
@@ -83,4 +86,4 @@ DEPENDENCIES
|
|
83
86
|
rubocop
|
84
87
|
|
85
88
|
BUNDLED WITH
|
86
|
-
2.
|
89
|
+
2.2.15
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "appraisal"
|
6
|
+
gem "database_cleaner-active_record"
|
7
|
+
gem "pg"
|
8
|
+
gem "rake", "~> 12.0"
|
9
|
+
gem "rspec", "~> 3.0"
|
10
|
+
gem "rubocop"
|
11
|
+
gem "activerecord", "~> 6.1.0"
|
12
|
+
|
13
|
+
gemspec path: "../"
|
@@ -0,0 +1,89 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
cursor_pager (0.3.0)
|
5
|
+
activerecord (>= 5.2.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activemodel (6.1.3.1)
|
11
|
+
activesupport (= 6.1.3.1)
|
12
|
+
activerecord (6.1.3.1)
|
13
|
+
activemodel (= 6.1.3.1)
|
14
|
+
activesupport (= 6.1.3.1)
|
15
|
+
activesupport (6.1.3.1)
|
16
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
|
+
i18n (>= 1.6, < 2)
|
18
|
+
minitest (>= 5.1)
|
19
|
+
tzinfo (~> 2.0)
|
20
|
+
zeitwerk (~> 2.3)
|
21
|
+
appraisal (2.4.0)
|
22
|
+
bundler
|
23
|
+
rake
|
24
|
+
thor (>= 0.14.0)
|
25
|
+
ast (2.4.2)
|
26
|
+
concurrent-ruby (1.1.8)
|
27
|
+
database_cleaner-active_record (2.0.0)
|
28
|
+
activerecord (>= 5.a)
|
29
|
+
database_cleaner-core (~> 2.0.0)
|
30
|
+
database_cleaner-core (2.0.1)
|
31
|
+
diff-lcs (1.4.4)
|
32
|
+
i18n (1.8.10)
|
33
|
+
concurrent-ruby (~> 1.0)
|
34
|
+
minitest (5.14.4)
|
35
|
+
parallel (1.20.1)
|
36
|
+
parser (3.0.0.0)
|
37
|
+
ast (~> 2.4.1)
|
38
|
+
pg (1.2.3)
|
39
|
+
rainbow (3.0.0)
|
40
|
+
rake (12.3.3)
|
41
|
+
regexp_parser (2.1.1)
|
42
|
+
rexml (3.2.4)
|
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.1)
|
48
|
+
rspec-support (~> 3.10.0)
|
49
|
+
rspec-expectations (3.10.1)
|
50
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
51
|
+
rspec-support (~> 3.10.0)
|
52
|
+
rspec-mocks (3.10.2)
|
53
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
54
|
+
rspec-support (~> 3.10.0)
|
55
|
+
rspec-support (3.10.2)
|
56
|
+
rubocop (1.12.0)
|
57
|
+
parallel (~> 1.10)
|
58
|
+
parser (>= 3.0.0.0)
|
59
|
+
rainbow (>= 2.2.2, < 4.0)
|
60
|
+
regexp_parser (>= 1.8, < 3.0)
|
61
|
+
rexml
|
62
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
63
|
+
ruby-progressbar (~> 1.7)
|
64
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
65
|
+
rubocop-ast (1.4.1)
|
66
|
+
parser (>= 2.7.1.5)
|
67
|
+
ruby-progressbar (1.11.0)
|
68
|
+
thor (1.1.0)
|
69
|
+
tzinfo (2.0.4)
|
70
|
+
concurrent-ruby (~> 1.0)
|
71
|
+
unicode-display_width (2.0.0)
|
72
|
+
zeitwerk (2.4.2)
|
73
|
+
|
74
|
+
PLATFORMS
|
75
|
+
ruby
|
76
|
+
x86_64-darwin-19
|
77
|
+
|
78
|
+
DEPENDENCIES
|
79
|
+
activerecord (~> 6.1.0)
|
80
|
+
appraisal
|
81
|
+
cursor_pager!
|
82
|
+
database_cleaner-active_record
|
83
|
+
pg
|
84
|
+
rake (~> 12.0)
|
85
|
+
rspec (~> 3.0)
|
86
|
+
rubocop
|
87
|
+
|
88
|
+
BUNDLED WITH
|
89
|
+
2.2.15
|
@@ -3,7 +3,11 @@
|
|
3
3
|
module CursorPager
|
4
4
|
# Will be raised when the cursor's record couldn't be found in the relation.
|
5
5
|
class CursorNotFoundError < Error
|
6
|
+
|
7
|
+
attr_reader :cursor
|
8
|
+
|
6
9
|
def initialize(cursor)
|
10
|
+
@cursor = cursor
|
7
11
|
message = "Couldn't find item for cursor: #{cursor}."
|
8
12
|
|
9
13
|
super(message)
|
data/lib/cursor_pager/page.rb
CHANGED
@@ -60,7 +60,7 @@ module CursorPager
|
|
60
60
|
@next_page ||= if before_limit_value.present?
|
61
61
|
true
|
62
62
|
elsif first
|
63
|
-
sliced_relation.
|
63
|
+
sliced_relation.offset(first).exists?
|
64
64
|
else
|
65
65
|
false
|
66
66
|
end
|
@@ -147,14 +147,23 @@ module CursorPager
|
|
147
147
|
end
|
148
148
|
|
149
149
|
def limit_value_for(cursor)
|
150
|
-
|
151
|
-
|
152
|
-
selects = order_values.map(&:select_string)
|
153
|
-
item = relation.where(id: id).select(selects).first
|
150
|
+
item = limit_item_for(cursor)
|
154
151
|
|
155
152
|
raise CursorNotFoundError, cursor if item.blank?
|
156
153
|
|
157
154
|
order_values.map { |value| item[value.select_alias] }
|
158
155
|
end
|
156
|
+
|
157
|
+
def limit_item_for(cursor)
|
158
|
+
id = encoder.decode(cursor)
|
159
|
+
|
160
|
+
selects = order_values.map(&:select_string)
|
161
|
+
ordered_relation_copy = ordered_relation.dup
|
162
|
+
|
163
|
+
ordered_relation_copy.preload_values = []
|
164
|
+
ordered_relation_copy.eager_load_values = []
|
165
|
+
ordered_relation_copy
|
166
|
+
.unscope(:includes).where(id: id).select(selects).first
|
167
|
+
end
|
159
168
|
end
|
160
169
|
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.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bastian Bartmann
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 5.2.0
|
27
|
-
description:
|
27
|
+
description:
|
28
28
|
email:
|
29
29
|
- bastian.bartmann@check24.de
|
30
30
|
executables: []
|
@@ -53,6 +53,8 @@ files:
|
|
53
53
|
- gemfiles/activerecord_5.2.gemfile.lock
|
54
54
|
- gemfiles/activerecord_6.0.gemfile
|
55
55
|
- gemfiles/activerecord_6.0.gemfile.lock
|
56
|
+
- gemfiles/activerecord_6.1.gemfile
|
57
|
+
- gemfiles/activerecord_6.1.gemfile.lock
|
56
58
|
- lib/cursor_pager.rb
|
57
59
|
- lib/cursor_pager/base64_encoder.rb
|
58
60
|
- lib/cursor_pager/configuration.rb
|
@@ -66,14 +68,14 @@ files:
|
|
66
68
|
- lib/cursor_pager/page.rb
|
67
69
|
- lib/cursor_pager/slice_relation.rb
|
68
70
|
- lib/cursor_pager/version.rb
|
69
|
-
homepage: https://github.com/
|
71
|
+
homepage: https://github.com/check24-profis/shared-cursor-pager
|
70
72
|
licenses:
|
71
73
|
- MIT
|
72
74
|
metadata:
|
73
|
-
homepage_uri: https://github.com/
|
74
|
-
source_code_uri: https://github.com/
|
75
|
-
changelog_uri: https://github.com/
|
76
|
-
post_install_message:
|
75
|
+
homepage_uri: https://github.com/check24-profis/shared-cursor-pager
|
76
|
+
source_code_uri: https://github.com/check24-profis/shared-cursor-pager
|
77
|
+
changelog_uri: https://github.com/check24-profis/shared-cursor-pager/blob/main/CHANGELOG.md
|
78
|
+
post_install_message:
|
77
79
|
rdoc_options: []
|
78
80
|
require_paths:
|
79
81
|
- lib
|
@@ -88,8 +90,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
90
|
- !ruby/object:Gem::Version
|
89
91
|
version: '0'
|
90
92
|
requirements: []
|
91
|
-
rubygems_version: 3.1.
|
92
|
-
signing_key:
|
93
|
+
rubygems_version: 3.1.4
|
94
|
+
signing_key:
|
93
95
|
specification_version: 4
|
94
96
|
summary: Cursor-based pagination for ActiveRecord relations.
|
95
97
|
test_files: []
|