sequel-keyset_pagination 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2e196af0224272c18188558ec8985ad9fd6b0cd2
4
- data.tar.gz: df8465b47dcae2d5c1142af8a8bba914117aa95d
2
+ SHA256:
3
+ metadata.gz: 9d42a224789c0b0ae9f6e6f82e764f40d3a9af1824cca8736a840931158477d5
4
+ data.tar.gz: ce81621442792fe014488a910b90976738e011e12116d69fceb36064da2e1483
5
5
  SHA512:
6
- metadata.gz: 6cbfcba7713d84c43b2cdbaaa090c0b832600d3a47e9b0d37caccd6d5a3697438f08b563478ac7fa68e9086ca35bdb5fd81e7b78a599e53685d81129991b1c7c
7
- data.tar.gz: 8237d47d36a49070d34454a61738f4eaa17f621594bd068e4ccc109309496f38968a70723235117fb2484d0be7b845d86dfa957fb7d44a021db717edbb0e05c4
6
+ metadata.gz: 53a3baa854e150f2100ab5c92e57efafe79162cb6bb28c27790f29382189edd0bf3c103385a2a579bf7d73cb6e9b6de00a9b14e95033b98c072f86db24741623
7
+ data.tar.gz: a3bb298a8e7787c3550513adcc9ba2311aeddce54c9f2afde3e03888ab1117aaf89b2768c1c54664838e483e6179fa1fcb21f519054e5f9b9c1dd6fb524edcd2
@@ -14,15 +14,15 @@ module Sequel
14
14
  end
15
15
  end
16
16
 
17
- def self.cursor_conditions(columns, cursor2, reverse: false)
18
- zipped = columns.zip(cursor2)
17
+ def self.cursor_conditions(columns, cursor, reverse: false)
18
+ zipped = columns.zip(cursor)
19
19
  desc = reverse ? :> : :<
20
20
  asc = reverse ? :< : :>
21
21
 
22
22
  # Reduce the dimensions
23
- segments = zipped.each_with_index.reverse_each.reduce([]) do |acc, ((column, cursor), idx)|
23
+ segments = zipped.each_with_index.reverse_each.reduce([]) do |acc, ((column, cursor_value), idx)|
24
24
  # We always start of with the leaf
25
- segment = [Sequel[column.expression].send(column.descending ? desc : asc, cursor)]
25
+ segment = [Sequel[column.expression].send(column.descending ? desc : asc, cursor_value)]
26
26
 
27
27
  # Scope the leaf to its higher level dimensions
28
28
  zipped.slice(0, idx).each do |(col, cur)|
@@ -55,15 +55,11 @@ module Sequel
55
55
  end
56
56
 
57
57
  columns = opts[:order].map { |o| Utils.qualify_order(o) }
58
- conditions = []
59
58
 
60
- if after
61
- conditions << Utils.cursor_conditions(columns, after)
62
- end
59
+ conditions = []
63
60
 
64
- if before
65
- conditions << Utils.cursor_conditions(columns, before, reverse: true)
66
- end
61
+ conditions << Utils.cursor_conditions(columns, after) if after
62
+ conditions << Utils.cursor_conditions(columns, before, reverse: true) if before
67
63
 
68
64
  where(Sequel.&(*conditions))
69
65
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel-keyset_pagination
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sarah Henkens
@@ -16,14 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.12'
19
+ version: '5.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '5.12'
26
+ version: '5.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.8'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.8'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sqlite3
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
27
55
  description: Adds support to Sequel for easy cursor based pagination on datasets
28
56
  email:
29
57
  - sarah.a.henkens@gmail.com
@@ -52,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
52
80
  version: '0'
53
81
  requirements: []
54
82
  rubyforge_project:
55
- rubygems_version: 2.5.2.3
83
+ rubygems_version: 2.7.3
56
84
  signing_key:
57
85
  specification_version: 4
58
86
  summary: Keyset Pagination Extension for Sequel