dynamoid_advanced_where 1.3.0 → 1.4.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/Appraisals +5 -4
- data/Gemfile +4 -3
- data/Gemfile.lock +29 -28
- data/README.md +17 -0
- data/Rakefile +5 -3
- data/dynamoid_advanced_where.gemspec +4 -2
- data/gemfiles/dynamoid_3.4.gemfile +6 -4
- data/gemfiles/dynamoid_3.5.gemfile +6 -4
- data/gemfiles/dynamoid_3.6.gemfile +6 -4
- data/gemfiles/dynamoid_latest.gemfile +6 -4
- data/gemfiles/dynamoid_master.gemfile +6 -4
- data/lib/dynamoid_advanced_where/batched_updater.rb +24 -11
- data/lib/dynamoid_advanced_where/integrations/model.rb +1 -1
- data/lib/dynamoid_advanced_where/nodes/and_node.rb +0 -1
- data/lib/dynamoid_advanced_where/nodes/base_node.rb +2 -1
- data/lib/dynamoid_advanced_where/nodes/exists_node.rb +1 -0
- data/lib/dynamoid_advanced_where/nodes/field_node.rb +10 -20
- data/lib/dynamoid_advanced_where/nodes/greater_than_node.rb +2 -0
- data/lib/dynamoid_advanced_where/nodes/includes.rb +2 -0
- data/lib/dynamoid_advanced_where/nodes/literal_node.rb +1 -0
- data/lib/dynamoid_advanced_where/nodes/not.rb +0 -1
- data/lib/dynamoid_advanced_where/nodes/or_node.rb +2 -0
- data/lib/dynamoid_advanced_where/nodes/root_node.rb +1 -1
- data/lib/dynamoid_advanced_where/nodes.rb +2 -0
- data/lib/dynamoid_advanced_where/query_builder.rb +2 -0
- data/lib/dynamoid_advanced_where/version.rb +3 -1
- data/lib/dynamoid_advanced_where.rb +5 -3
- metadata +17 -17
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 77c5c86c6aeccd5d5cd9db4a6e030a3527d17c87776fb05de5a06966699a1167
|
|
4
|
+
data.tar.gz: 02426eb629574d8bcd1ec7507c1f6795d0e3f22577ef54c21bf203351ccd81d3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dcb79577e6f5e90cccb482e77d26614f7be1fe16bf265970441176fd794c0760107a994f444eabe9290151f5dfea9d8c263f359b663e7d5c87536a85540c38ac
|
|
7
|
+
data.tar.gz: 5e736cf0adaa648c1b088ddb938ce8a41080df77e243fe8cb0cb70fb561ae985582e3002c9078eed4d2ebd3284cccee30c657d9f24806082520f0055c5b22849
|
data/Appraisals
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
|
|
2
|
-
appraise
|
|
3
|
-
gem
|
|
3
|
+
appraise 'dynamoid-3.4' do
|
|
4
|
+
gem 'dynamoid', '~> 3.4.0'
|
|
4
5
|
end
|
|
5
6
|
|
|
6
|
-
appraise
|
|
7
|
-
gem
|
|
7
|
+
appraise 'dynamoid-latest' do
|
|
8
|
+
gem 'dynamoid', '~> 3.0'
|
|
8
9
|
end
|
data/Gemfile
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
source 'https://rubygems.org'
|
|
4
|
+
|
|
5
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
4
6
|
|
|
5
7
|
# Specify your gem's dependencies in dynamoid-advanced-where.gemspec
|
|
6
8
|
gemspec
|
|
7
9
|
|
|
8
10
|
gem 'pry'
|
|
9
|
-
|
data/Gemfile.lock
CHANGED
|
@@ -1,71 +1,72 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
dynamoid_advanced_where (1.
|
|
4
|
+
dynamoid_advanced_where (1.4.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.4)
|
|
11
|
+
activesupport (= 6.1.4)
|
|
12
|
+
activesupport (6.1.4)
|
|
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.4.
|
|
18
|
+
appraisal (2.4.1)
|
|
19
19
|
bundler
|
|
20
20
|
rake
|
|
21
21
|
thor (>= 0.14.0)
|
|
22
22
|
ast (2.4.2)
|
|
23
|
-
aws-eventstream (1.1.
|
|
24
|
-
aws-partitions (1.
|
|
25
|
-
aws-sdk-core (3.
|
|
23
|
+
aws-eventstream (1.1.1)
|
|
24
|
+
aws-partitions (1.482.0)
|
|
25
|
+
aws-sdk-core (3.119.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.62.0)
|
|
31
|
+
aws-sdk-core (~> 3, >= 3.119.0)
|
|
32
32
|
aws-sigv4 (~> 1.1)
|
|
33
|
-
aws-sigv4 (1.2.
|
|
33
|
+
aws-sigv4 (1.2.4)
|
|
34
34
|
aws-eventstream (~> 1, >= 1.0.2)
|
|
35
|
-
bundler-audit (0.
|
|
35
|
+
bundler-audit (0.8.0)
|
|
36
36
|
bundler (>= 1.2.0, < 3)
|
|
37
|
-
thor (
|
|
38
|
-
childprocess (4.
|
|
37
|
+
thor (~> 1.0)
|
|
38
|
+
childprocess (4.1.0)
|
|
39
39
|
coderay (1.1.3)
|
|
40
40
|
colorize (0.8.1)
|
|
41
|
-
concurrent-ruby (1.1.
|
|
41
|
+
concurrent-ruby (1.1.9)
|
|
42
42
|
diff-lcs (1.4.4)
|
|
43
|
-
dynamoid (3.7.
|
|
43
|
+
dynamoid (3.7.1)
|
|
44
44
|
activemodel (>= 4)
|
|
45
45
|
aws-sdk-dynamodb (~> 1.0)
|
|
46
46
|
concurrent-ruby (>= 1.0)
|
|
47
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.10)
|
|
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
55
|
minitest (5.14.4)
|
|
56
|
-
overcommit (0.
|
|
56
|
+
overcommit (0.58.0)
|
|
57
57
|
childprocess (>= 0.6.3, < 5)
|
|
58
58
|
iniparse (~> 1.4)
|
|
59
|
+
rexml (~> 3.2)
|
|
59
60
|
parallel (1.20.1)
|
|
60
|
-
parser (3.0.
|
|
61
|
+
parser (3.0.2.0)
|
|
61
62
|
ast (~> 2.4.1)
|
|
62
|
-
pry (0.14.
|
|
63
|
+
pry (0.14.1)
|
|
63
64
|
coderay (~> 1.1)
|
|
64
65
|
method_source (~> 1.0)
|
|
65
66
|
rainbow (3.0.0)
|
|
66
67
|
rake (10.5.0)
|
|
67
68
|
regexp_parser (2.1.1)
|
|
68
|
-
rexml (3.2.
|
|
69
|
+
rexml (3.2.5)
|
|
69
70
|
rspec (3.10.0)
|
|
70
71
|
rspec-core (~> 3.10.0)
|
|
71
72
|
rspec-expectations (~> 3.10.0)
|
|
@@ -79,21 +80,21 @@ GEM
|
|
|
79
80
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
80
81
|
rspec-support (~> 3.10.0)
|
|
81
82
|
rspec-support (3.10.2)
|
|
82
|
-
rubocop (1.
|
|
83
|
+
rubocop (1.18.4)
|
|
83
84
|
parallel (~> 1.10)
|
|
84
85
|
parser (>= 3.0.0.0)
|
|
85
86
|
rainbow (>= 2.2.2, < 4.0)
|
|
86
87
|
regexp_parser (>= 1.8, < 3.0)
|
|
87
88
|
rexml
|
|
88
|
-
rubocop-ast (>= 1.
|
|
89
|
+
rubocop-ast (>= 1.8.0, < 2.0)
|
|
89
90
|
ruby-progressbar (~> 1.7)
|
|
90
91
|
unicode-display_width (>= 1.4.0, < 3.0)
|
|
91
|
-
rubocop-ast (1.
|
|
92
|
-
parser (>=
|
|
92
|
+
rubocop-ast (1.8.0)
|
|
93
|
+
parser (>= 3.0.1.1)
|
|
93
94
|
ruby-progressbar (1.11.0)
|
|
94
|
-
ruby_parser (3.
|
|
95
|
-
sexp_processor (~> 4.
|
|
96
|
-
sexp_processor (4.15.
|
|
95
|
+
ruby_parser (3.16.0)
|
|
96
|
+
sexp_processor (~> 4.15, >= 4.15.1)
|
|
97
|
+
sexp_processor (4.15.3)
|
|
97
98
|
thor (1.1.0)
|
|
98
99
|
tzinfo (2.0.4)
|
|
99
100
|
concurrent-ruby (~> 1.0)
|
data/README.md
CHANGED
|
@@ -249,6 +249,23 @@ if it successfully updates. If it fails to update, it will return nil.
|
|
|
249
249
|
If the specified hash key, or hash/range key combination is not already present
|
|
250
250
|
it will be inserted with the desired mutations (if possible).
|
|
251
251
|
|
|
252
|
+
### Referencing a field
|
|
253
|
+
To identify the field to be updated, either through set, increment, decrement, or append you may just use the field name
|
|
254
|
+
for top level keys. When you use the top level single symbol key DAW will use the built in Dynamoid dumper.
|
|
255
|
+
|
|
256
|
+
If you need to reference the sub-key of a map, or custom serialized object you may pass an array of keys. Since DAW
|
|
257
|
+
looses context to the "type" it is up to you to ensure you are writing out the correct values. The only exception to
|
|
258
|
+
this is if you are set the field to a class which implements `dynamoid_dump`.
|
|
259
|
+
|
|
260
|
+
#### Example
|
|
261
|
+
```ruby
|
|
262
|
+
Model.where{ conditions }.batch_update
|
|
263
|
+
.set_values([:map_or_custom_type, :sub_field, :foo] => 'value', [:map_or_custom_type2, :foo] => MyDumpableClass.new(test))
|
|
264
|
+
.increment([:some_map, :attempts], by: 1)
|
|
265
|
+
.decrement([:some_map, :attempts_remaining], by: 1)
|
|
266
|
+
.apply(hash_key, range_key)
|
|
267
|
+
```
|
|
268
|
+
|
|
252
269
|
### Setting a single field
|
|
253
270
|
The batch updated method `set_values(attr_name: new_attr_value, other_atter: val)`
|
|
254
271
|
|
data/Rakefile
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
lib = File.expand_path('lib', __dir__)
|
|
2
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
5
|
require 'dynamoid_advanced_where/version'
|
|
@@ -30,12 +32,12 @@ Gem::Specification.new do |spec|
|
|
|
30
32
|
|
|
31
33
|
spec.add_dependency 'dynamoid', '>= 3.2', '< 4'
|
|
32
34
|
|
|
33
|
-
spec.add_development_dependency '
|
|
35
|
+
spec.add_development_dependency 'appraisal'
|
|
34
36
|
spec.add_development_dependency 'bundler', '>= 1.16'
|
|
37
|
+
spec.add_development_dependency 'bundler-audit'
|
|
35
38
|
spec.add_development_dependency 'fasterer'
|
|
36
39
|
spec.add_development_dependency 'overcommit'
|
|
37
40
|
spec.add_development_dependency 'rake', '~> 10.0'
|
|
38
41
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
39
42
|
spec.add_development_dependency 'rubocop'
|
|
40
|
-
spec.add_development_dependency 'appraisal'
|
|
41
43
|
end
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# This file was generated by Appraisal
|
|
2
4
|
|
|
3
|
-
source
|
|
5
|
+
source 'https://rubygems.org'
|
|
4
6
|
|
|
5
|
-
gem
|
|
6
|
-
gem
|
|
7
|
+
gem 'dynamoid', '~> 3.4.0'
|
|
8
|
+
gem 'pry'
|
|
7
9
|
|
|
8
|
-
gemspec path:
|
|
10
|
+
gemspec path: '../'
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# This file was generated by Appraisal
|
|
2
4
|
|
|
3
|
-
source
|
|
5
|
+
source 'https://rubygems.org'
|
|
4
6
|
|
|
5
|
-
gem
|
|
6
|
-
gem
|
|
7
|
+
gem 'dynamoid', '~> 3.5.0'
|
|
8
|
+
gem 'pry'
|
|
7
9
|
|
|
8
|
-
gemspec path:
|
|
10
|
+
gemspec path: '../'
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# This file was generated by Appraisal
|
|
2
4
|
|
|
3
|
-
source
|
|
5
|
+
source 'https://rubygems.org'
|
|
4
6
|
|
|
5
|
-
gem
|
|
6
|
-
gem
|
|
7
|
+
gem 'dynamoid', '~> 3.6.0'
|
|
8
|
+
gem 'pry'
|
|
7
9
|
|
|
8
|
-
gemspec path:
|
|
10
|
+
gemspec path: '../'
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# This file was generated by Appraisal
|
|
2
4
|
|
|
3
|
-
source
|
|
5
|
+
source 'https://rubygems.org'
|
|
4
6
|
|
|
5
|
-
gem
|
|
6
|
-
gem
|
|
7
|
+
gem 'dynamoid', '~> 3.0'
|
|
8
|
+
gem 'pry'
|
|
7
9
|
|
|
8
|
-
gemspec path:
|
|
10
|
+
gemspec path: '../'
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# This file was generated by Appraisal
|
|
2
4
|
|
|
3
|
-
source
|
|
5
|
+
source 'https://rubygems.org'
|
|
4
6
|
|
|
5
|
-
gem
|
|
6
|
-
gem
|
|
7
|
+
gem 'dynamoid', git: 'https://github.com/Dynamoid/dynamoid.git'
|
|
8
|
+
gem 'pry'
|
|
7
9
|
|
|
8
|
-
gemspec path:
|
|
10
|
+
gemspec path: '../'
|
|
@@ -5,6 +5,7 @@ module DynamoidAdvancedWhere
|
|
|
5
5
|
DEEP_MERGE_ATTRIBUTES = %i[expression_attribute_names expression_attribute_values].freeze
|
|
6
6
|
|
|
7
7
|
attr_accessor :query_builder, :_set_values, :_array_appends, :_set_appends, :_increments
|
|
8
|
+
|
|
8
9
|
delegate :klass, to: :query_builder
|
|
9
10
|
|
|
10
11
|
def initialize(query_builder:)
|
|
@@ -86,7 +87,7 @@ module DynamoidAdvancedWhere
|
|
|
86
87
|
filter = merge_multiple_sets(
|
|
87
88
|
[
|
|
88
89
|
field_update_arguments,
|
|
89
|
-
add_update_args
|
|
90
|
+
add_update_args
|
|
90
91
|
],
|
|
91
92
|
result_base: filter_builder.to_scan_filter,
|
|
92
93
|
)
|
|
@@ -129,11 +130,10 @@ module DynamoidAdvancedWhere
|
|
|
129
130
|
|
|
130
131
|
_set_values.each_with_object(builder_hash) do |(k, v), h|
|
|
131
132
|
prefix = merge_in_attr_placeholders(h, k, v)
|
|
132
|
-
h[:collected_update_expression] << "
|
|
133
|
+
h[:collected_update_expression] << "#{prefix[0]} = :#{prefix[1]}"
|
|
133
134
|
end
|
|
134
135
|
end
|
|
135
136
|
|
|
136
|
-
|
|
137
137
|
def increment_field_updates
|
|
138
138
|
return {} if _increments.empty?
|
|
139
139
|
|
|
@@ -148,7 +148,7 @@ module DynamoidAdvancedWhere
|
|
|
148
148
|
|
|
149
149
|
_increments.each_with_object(builder_hash) do |(field, change), h|
|
|
150
150
|
prefix = merge_in_attr_placeholders(h, field, change)
|
|
151
|
-
builder_hash[:collected_update_expression] << "
|
|
151
|
+
builder_hash[:collected_update_expression] << "#{prefix[0]} = if_not_exists(#{prefix[0]}, :#{zero_prefix}) + :#{prefix[1]}"
|
|
152
152
|
end
|
|
153
153
|
end
|
|
154
154
|
|
|
@@ -158,7 +158,7 @@ module DynamoidAdvancedWhere
|
|
|
158
158
|
_set_appends.each_with_object(builder_hash) do |to_append, h|
|
|
159
159
|
to_append.each do |k, v|
|
|
160
160
|
prefix = merge_in_attr_placeholders(h, k, v)
|
|
161
|
-
builder_hash[:collected_update_expression] << "
|
|
161
|
+
builder_hash[:collected_update_expression] << "#{prefix[0]} :#{prefix[1]}"
|
|
162
162
|
end
|
|
163
163
|
end
|
|
164
164
|
end
|
|
@@ -176,7 +176,7 @@ module DynamoidAdvancedWhere
|
|
|
176
176
|
update_args = _array_appends.each_with_object(builder_hash) do |to_append, h|
|
|
177
177
|
to_append.each do |k, v|
|
|
178
178
|
prefix = merge_in_attr_placeholders(h, k, v)
|
|
179
|
-
builder_hash[:collected_update_expression] << "
|
|
179
|
+
builder_hash[:collected_update_expression] << "#{prefix[0]} = list_append(if_not_exists(#{prefix[0]}, :#{empty_list_prefix}), :#{prefix[1]})"
|
|
180
180
|
end
|
|
181
181
|
end
|
|
182
182
|
|
|
@@ -184,7 +184,7 @@ module DynamoidAdvancedWhere
|
|
|
184
184
|
end
|
|
185
185
|
|
|
186
186
|
def merge_in_attr_placeholders(hsh, field_name, value)
|
|
187
|
-
prefix, new_data = prefixerize(field_name, value)
|
|
187
|
+
*prefix, new_data = prefixerize(field_name, value)
|
|
188
188
|
|
|
189
189
|
hsh.merge!(new_data, &method(:hash_extendeer))
|
|
190
190
|
|
|
@@ -192,14 +192,20 @@ module DynamoidAdvancedWhere
|
|
|
192
192
|
end
|
|
193
193
|
|
|
194
194
|
def prefixerize(field_name, value)
|
|
195
|
+
field_names = field_name.is_a?(Array) ? field_name : [field_name]
|
|
195
196
|
prefix = SecureRandom.hex
|
|
196
197
|
|
|
198
|
+
update_target = field_names.each_with_index.map do |name, idx|
|
|
199
|
+
["##{prefix}#{idx}", name]
|
|
200
|
+
end
|
|
201
|
+
|
|
197
202
|
[
|
|
203
|
+
update_target.map(&:first).join('.').to_s,
|
|
198
204
|
prefix,
|
|
199
205
|
{
|
|
200
|
-
expression_attribute_names:
|
|
206
|
+
expression_attribute_names: Hash[update_target],
|
|
201
207
|
expression_attribute_values: {
|
|
202
|
-
":#{prefix}" => dump(value,
|
|
208
|
+
":#{prefix}" => dump(value, field_name)
|
|
203
209
|
}
|
|
204
210
|
}
|
|
205
211
|
]
|
|
@@ -222,8 +228,15 @@ module DynamoidAdvancedWhere
|
|
|
222
228
|
)
|
|
223
229
|
end
|
|
224
230
|
|
|
225
|
-
def dump(value,
|
|
226
|
-
|
|
231
|
+
def dump(value, field_name)
|
|
232
|
+
if klass.attributes[field_name]
|
|
233
|
+
Dynamoid::Dumping.dump_field(value, klass.attributes[field_name])
|
|
234
|
+
elsif value.respond_to?(:dynamoid_dump)
|
|
235
|
+
value.dynamoid_dump
|
|
236
|
+
else
|
|
237
|
+
value
|
|
238
|
+
|
|
239
|
+
end
|
|
227
240
|
end
|
|
228
241
|
end
|
|
229
242
|
end
|
|
@@ -20,9 +20,7 @@ module DynamoidAdvancedWhere
|
|
|
20
20
|
config.respond_to?(:call) ? config.call(attr_config) : config <= attr_config
|
|
21
21
|
end&.last
|
|
22
22
|
|
|
23
|
-
unless specific_klass
|
|
24
|
-
raise ArgumentError, "unable to find field type for `#{attr_config}`"
|
|
25
|
-
end
|
|
23
|
+
raise ArgumentError, "unable to find field type for `#{attr_config}`" unless specific_klass
|
|
26
24
|
|
|
27
25
|
specific_klass.new(field_path: field_path)
|
|
28
26
|
end
|
|
@@ -63,6 +61,7 @@ module DynamoidAdvancedWhere
|
|
|
63
61
|
class StringAttributeNode < FieldNode
|
|
64
62
|
include Concerns::SupportsIncludes
|
|
65
63
|
end
|
|
64
|
+
|
|
66
65
|
class NativeBooleanAttributeNode < FieldNode; end
|
|
67
66
|
|
|
68
67
|
class StringBooleanAttributeNode < FieldNode
|
|
@@ -91,9 +90,10 @@ module DynamoidAdvancedWhere
|
|
|
91
90
|
include Concerns::SupportsGreaterThan
|
|
92
91
|
|
|
93
92
|
def parse_right_hand_side(val)
|
|
94
|
-
|
|
93
|
+
case val
|
|
94
|
+
when Date
|
|
95
95
|
val.to_time.to_i
|
|
96
|
-
|
|
96
|
+
when Time
|
|
97
97
|
val.to_f
|
|
98
98
|
else
|
|
99
99
|
raise ArgumentError, "unable to compare datetime to type #{val.class}"
|
|
@@ -105,9 +105,7 @@ module DynamoidAdvancedWhere
|
|
|
105
105
|
include Concerns::SupportsGreaterThan
|
|
106
106
|
|
|
107
107
|
def parse_right_hand_side(val)
|
|
108
|
-
if !val.is_a?(Date) || val.is_a?(DateTime)
|
|
109
|
-
raise ArgumentError, "unable to compare date to type #{val.class}"
|
|
110
|
-
end
|
|
108
|
+
raise ArgumentError, "unable to compare date to type #{val.class}" if !val.is_a?(Date) || val.is_a?(DateTime)
|
|
111
109
|
|
|
112
110
|
(val - Dynamoid::Persistence::UNIX_EPOCH_DATE).to_i
|
|
113
111
|
end
|
|
@@ -117,9 +115,7 @@ module DynamoidAdvancedWhere
|
|
|
117
115
|
include Concerns::SupportsIncludes
|
|
118
116
|
|
|
119
117
|
def parse_right_hand_side(val)
|
|
120
|
-
unless val.is_a?(String)
|
|
121
|
-
raise ArgumentError, "unable to compare date to type #{val.class}"
|
|
122
|
-
end
|
|
118
|
+
raise ArgumentError, "unable to compare date to type #{val.class}" unless val.is_a?(String)
|
|
123
119
|
|
|
124
120
|
val
|
|
125
121
|
end
|
|
@@ -129,9 +125,7 @@ module DynamoidAdvancedWhere
|
|
|
129
125
|
include Concerns::SupportsIncludes
|
|
130
126
|
|
|
131
127
|
def parse_right_hand_side(val)
|
|
132
|
-
unless val.is_a?(Integer)
|
|
133
|
-
raise ArgumentError, "unable to compare integer value to type #{val.class}"
|
|
134
|
-
end
|
|
128
|
+
raise ArgumentError, "unable to compare integer value to type #{val.class}" unless val.is_a?(Integer)
|
|
135
129
|
|
|
136
130
|
val
|
|
137
131
|
end
|
|
@@ -141,9 +135,7 @@ module DynamoidAdvancedWhere
|
|
|
141
135
|
include Concerns::SupportsIncludes
|
|
142
136
|
|
|
143
137
|
def parse_right_hand_side(val)
|
|
144
|
-
unless val.is_a?(String)
|
|
145
|
-
raise ArgumentError, "unable to compare string to type #{val.class}"
|
|
146
|
-
end
|
|
138
|
+
raise ArgumentError, "unable to compare string to type #{val.class}" unless val.is_a?(String)
|
|
147
139
|
|
|
148
140
|
val
|
|
149
141
|
end
|
|
@@ -153,9 +145,7 @@ module DynamoidAdvancedWhere
|
|
|
153
145
|
include Concerns::SupportsIncludes
|
|
154
146
|
|
|
155
147
|
def parse_right_hand_side(val)
|
|
156
|
-
unless val.is_a?(Integer)
|
|
157
|
-
raise ArgumentError, "unable to compare integer to type #{val.class}"
|
|
158
|
-
end
|
|
148
|
+
raise ArgumentError, "unable to compare integer to type #{val.class}" unless val.is_a?(Integer)
|
|
159
149
|
|
|
160
150
|
val
|
|
161
151
|
end
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'dynamoid'
|
|
2
4
|
|
|
3
|
-
require
|
|
4
|
-
require
|
|
5
|
+
require 'dynamoid_advanced_where/version'
|
|
6
|
+
require 'dynamoid_advanced_where/integrations/model'
|
|
5
7
|
|
|
6
8
|
module DynamoidAdvancedWhere
|
|
7
|
-
|
|
9
|
+
# Your code goes here...
|
|
8
10
|
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.4.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: 2022-10-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: dynamoid
|
|
@@ -31,7 +31,7 @@ dependencies:
|
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
32
|
version: '4'
|
|
33
33
|
- !ruby/object:Gem::Dependency
|
|
34
|
-
name:
|
|
34
|
+
name: appraisal
|
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - ">="
|
|
@@ -58,6 +58,20 @@ dependencies:
|
|
|
58
58
|
- - ">="
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
60
|
version: '1.16'
|
|
61
|
+
- !ruby/object:Gem::Dependency
|
|
62
|
+
name: bundler-audit
|
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '0'
|
|
68
|
+
type: :development
|
|
69
|
+
prerelease: false
|
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '0'
|
|
61
75
|
- !ruby/object:Gem::Dependency
|
|
62
76
|
name: fasterer
|
|
63
77
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -128,20 +142,6 @@ dependencies:
|
|
|
128
142
|
- - ">="
|
|
129
143
|
- !ruby/object:Gem::Version
|
|
130
144
|
version: '0'
|
|
131
|
-
- !ruby/object:Gem::Dependency
|
|
132
|
-
name: appraisal
|
|
133
|
-
requirement: !ruby/object:Gem::Requirement
|
|
134
|
-
requirements:
|
|
135
|
-
- - ">="
|
|
136
|
-
- !ruby/object:Gem::Version
|
|
137
|
-
version: '0'
|
|
138
|
-
type: :development
|
|
139
|
-
prerelease: false
|
|
140
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
141
|
-
requirements:
|
|
142
|
-
- - ">="
|
|
143
|
-
- !ruby/object:Gem::Version
|
|
144
|
-
version: '0'
|
|
145
145
|
description: things
|
|
146
146
|
email:
|
|
147
147
|
- bmalinconico@terminus.com
|