dynamoid_advanced_where 1.2.0 → 1.3.0
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
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81b5cff1e68596d951a94a59b5bdba3e21bf032229b79d3adfae32d7abbb9613
|
4
|
+
data.tar.gz: 3764fc26d9e63c7543f9d49d9eb5b3e4fc0e532d2be7b2ded69855e7c9740277
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08a0e6c52f255817fa42a213aff15943f624f5657c7e24a01d370f54f0bad8d030e3a7587e8994a27bbdb68a8c6d05bbf6396dc22215470d28adf0ab8f1f6e85'
|
7
|
+
data.tar.gz: 61a2d7b5f5de111ea8e7677de91e1120b17085ca4d3c13c104828ee01066a0ffc8b40bad45d90af4db4c29704bffb1b4122816ab174f7f140ed72ce305ee7310
|
data/Gemfile.lock
CHANGED
@@ -1,34 +1,34 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dynamoid_advanced_where (1.
|
4
|
+
dynamoid_advanced_where (1.3.0)
|
5
5
|
dynamoid (>= 3.2, < 4)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activemodel (6.1.
|
11
|
-
activesupport (= 6.1.
|
12
|
-
activesupport (6.1.
|
10
|
+
activemodel (6.1.3)
|
11
|
+
activesupport (= 6.1.3)
|
12
|
+
activesupport (6.1.3)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
14
|
i18n (>= 1.6, < 2)
|
15
15
|
minitest (>= 5.1)
|
16
16
|
tzinfo (~> 2.0)
|
17
17
|
zeitwerk (~> 2.3)
|
18
|
-
appraisal (2.
|
18
|
+
appraisal (2.4.0)
|
19
19
|
bundler
|
20
20
|
rake
|
21
21
|
thor (>= 0.14.0)
|
22
|
-
ast (2.4.
|
22
|
+
ast (2.4.2)
|
23
23
|
aws-eventstream (1.1.0)
|
24
|
-
aws-partitions (1.
|
25
|
-
aws-sdk-core (3.
|
24
|
+
aws-partitions (1.430.0)
|
25
|
+
aws-sdk-core (3.112.0)
|
26
26
|
aws-eventstream (~> 1, >= 1.0.2)
|
27
27
|
aws-partitions (~> 1, >= 1.239.0)
|
28
28
|
aws-sigv4 (~> 1.1)
|
29
29
|
jmespath (~> 1.0)
|
30
|
-
aws-sdk-dynamodb (1.
|
31
|
-
aws-sdk-core (~> 3, >= 3.
|
30
|
+
aws-sdk-dynamodb (1.59.0)
|
31
|
+
aws-sdk-core (~> 3, >= 3.112.0)
|
32
32
|
aws-sigv4 (~> 1.1)
|
33
33
|
aws-sigv4 (1.2.2)
|
34
34
|
aws-eventstream (~> 1, >= 1.0.2)
|
@@ -38,66 +38,66 @@ GEM
|
|
38
38
|
childprocess (4.0.0)
|
39
39
|
coderay (1.1.3)
|
40
40
|
colorize (0.8.1)
|
41
|
-
concurrent-ruby (1.1.
|
41
|
+
concurrent-ruby (1.1.8)
|
42
42
|
diff-lcs (1.4.4)
|
43
|
-
dynamoid (3.
|
43
|
+
dynamoid (3.7.0)
|
44
44
|
activemodel (>= 4)
|
45
45
|
aws-sdk-dynamodb (~> 1.0)
|
46
46
|
concurrent-ruby (>= 1.0)
|
47
|
-
fasterer (0.
|
47
|
+
fasterer (0.9.0)
|
48
48
|
colorize (~> 0.7)
|
49
49
|
ruby_parser (>= 3.14.1)
|
50
|
-
i18n (1.8.
|
50
|
+
i18n (1.8.9)
|
51
51
|
concurrent-ruby (~> 1.0)
|
52
52
|
iniparse (1.5.0)
|
53
53
|
jmespath (1.4.0)
|
54
54
|
method_source (1.0.0)
|
55
|
-
minitest (5.14.
|
55
|
+
minitest (5.14.4)
|
56
56
|
overcommit (0.57.0)
|
57
57
|
childprocess (>= 0.6.3, < 5)
|
58
58
|
iniparse (~> 1.4)
|
59
59
|
parallel (1.20.1)
|
60
|
-
parser (
|
60
|
+
parser (3.0.0.0)
|
61
61
|
ast (~> 2.4.1)
|
62
|
-
pry (0.
|
62
|
+
pry (0.14.0)
|
63
63
|
coderay (~> 1.1)
|
64
64
|
method_source (~> 1.0)
|
65
65
|
rainbow (3.0.0)
|
66
66
|
rake (10.5.0)
|
67
|
-
regexp_parser (2.
|
67
|
+
regexp_parser (2.1.1)
|
68
68
|
rexml (3.2.4)
|
69
69
|
rspec (3.10.0)
|
70
70
|
rspec-core (~> 3.10.0)
|
71
71
|
rspec-expectations (~> 3.10.0)
|
72
72
|
rspec-mocks (~> 3.10.0)
|
73
|
-
rspec-core (3.10.
|
73
|
+
rspec-core (3.10.1)
|
74
74
|
rspec-support (~> 3.10.0)
|
75
|
-
rspec-expectations (3.10.
|
75
|
+
rspec-expectations (3.10.1)
|
76
76
|
diff-lcs (>= 1.2.0, < 2.0)
|
77
77
|
rspec-support (~> 3.10.0)
|
78
|
-
rspec-mocks (3.10.
|
78
|
+
rspec-mocks (3.10.2)
|
79
79
|
diff-lcs (>= 1.2.0, < 2.0)
|
80
80
|
rspec-support (~> 3.10.0)
|
81
|
-
rspec-support (3.10.
|
82
|
-
rubocop (1.
|
81
|
+
rspec-support (3.10.2)
|
82
|
+
rubocop (1.11.0)
|
83
83
|
parallel (~> 1.10)
|
84
|
-
parser (>=
|
84
|
+
parser (>= 3.0.0.0)
|
85
85
|
rainbow (>= 2.2.2, < 4.0)
|
86
86
|
regexp_parser (>= 1.8, < 3.0)
|
87
87
|
rexml
|
88
88
|
rubocop-ast (>= 1.2.0, < 2.0)
|
89
89
|
ruby-progressbar (~> 1.7)
|
90
|
-
unicode-display_width (>= 1.4.0, <
|
91
|
-
rubocop-ast (1.
|
90
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
91
|
+
rubocop-ast (1.4.1)
|
92
92
|
parser (>= 2.7.1.5)
|
93
|
-
ruby-progressbar (1.
|
94
|
-
ruby_parser (3.15.
|
93
|
+
ruby-progressbar (1.11.0)
|
94
|
+
ruby_parser (3.15.1)
|
95
95
|
sexp_processor (~> 4.9)
|
96
|
-
sexp_processor (4.15.
|
97
|
-
thor (1.0
|
96
|
+
sexp_processor (4.15.2)
|
97
|
+
thor (1.1.0)
|
98
98
|
tzinfo (2.0.4)
|
99
99
|
concurrent-ruby (~> 1.0)
|
100
|
-
unicode-display_width (
|
100
|
+
unicode-display_width (2.0.0)
|
101
101
|
zeitwerk (2.4.2)
|
102
102
|
|
103
103
|
PLATFORMS
|
@@ -4,14 +4,15 @@ require_relative './batched_updater'
|
|
4
4
|
|
5
5
|
module DynamoidAdvancedWhere
|
6
6
|
class QueryBuilder
|
7
|
-
attr_accessor :klass, :root_node, :start_hash
|
7
|
+
attr_accessor :klass, :root_node, :start_hash, :record_limit
|
8
8
|
|
9
|
-
delegate :all, :each, to: :query_materializer
|
9
|
+
delegate :all, :each_page, :each, to: :query_materializer
|
10
10
|
|
11
|
-
def initialize(klass:, start_hash: nil, root_node: nil, &blk)
|
11
|
+
def initialize(klass:, record_limit: nil, start_hash: nil, root_node: nil, &blk)
|
12
12
|
self.klass = klass
|
13
13
|
self.root_node = root_node || Nodes::RootNode.new(klass: klass, &blk)
|
14
14
|
self.start_hash = start_hash
|
15
|
+
self.record_limit = record_limit
|
15
16
|
|
16
17
|
freeze
|
17
18
|
end
|
@@ -46,10 +47,26 @@ module DynamoidAdvancedWhere
|
|
46
47
|
end
|
47
48
|
alias and where
|
48
49
|
|
50
|
+
def limit(value)
|
51
|
+
dup_with_changes(record_limit: value)
|
52
|
+
end
|
53
|
+
|
49
54
|
def start(key_hash)
|
50
55
|
return self if key_hash.nil? || key_hash.empty?
|
51
56
|
|
52
|
-
|
57
|
+
dup_with_changes(start_hash: key_hash)
|
58
|
+
end
|
59
|
+
|
60
|
+
alias to_a all
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def dup_with_changes(**changes)
|
65
|
+
self.class.new(**{
|
66
|
+
klass: klass,
|
67
|
+
start_hash: start_hash,
|
68
|
+
root_node: root_node
|
69
|
+
}.merge(changes))
|
53
70
|
end
|
54
71
|
end
|
55
72
|
end
|
@@ -51,6 +51,8 @@ module DynamoidAdvancedWhere
|
|
51
51
|
table_name: table_name
|
52
52
|
}.merge(filter_builder.to_query_filter)
|
53
53
|
|
54
|
+
query[:limit] = query_builder.record_limit if query_builder.record_limit
|
55
|
+
|
54
56
|
page_start = start_hash
|
55
57
|
|
56
58
|
Enumerator.new do |yielder|
|
@@ -63,7 +65,11 @@ module DynamoidAdvancedWhere
|
|
63
65
|
|
64
66
|
yielder.yield(items, results)
|
65
67
|
|
66
|
-
|
68
|
+
query[:limit] = query[:limit] - results.items.length if query[:limit]
|
69
|
+
|
70
|
+
break if results.last_evaluated_key.nil? || query[:limit]&.zero?
|
71
|
+
|
72
|
+
(page_start = results.last_evaluated_key)
|
67
73
|
end
|
68
74
|
end.lazy
|
69
75
|
end
|
@@ -73,6 +79,8 @@ module DynamoidAdvancedWhere
|
|
73
79
|
table_name: table_name
|
74
80
|
}.merge(filter_builder.to_scan_filter)
|
75
81
|
|
82
|
+
query[:limit] = query_builder.record_limit if query_builder.record_limit
|
83
|
+
|
76
84
|
page_start = start_hash
|
77
85
|
|
78
86
|
Enumerator.new do |yielder|
|
@@ -85,7 +93,11 @@ module DynamoidAdvancedWhere
|
|
85
93
|
|
86
94
|
yielder.yield(items, results)
|
87
95
|
|
88
|
-
|
96
|
+
query[:limit] = query[:limit] - results.items.length if query[:limit]
|
97
|
+
|
98
|
+
break if results.last_evaluated_key.nil? || query[:limit]&.zero?
|
99
|
+
|
100
|
+
(page_start = results.last_evaluated_key)
|
89
101
|
end
|
90
102
|
end.lazy
|
91
103
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynamoid_advanced_where
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Malinconico
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dynamoid
|