dynamoid 3.9.0 → 3.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -6
  3. data/README.md +202 -25
  4. data/dynamoid.gemspec +5 -6
  5. data/lib/dynamoid/adapter.rb +19 -13
  6. data/lib/dynamoid/adapter_plugin/aws_sdk_v3/create_table.rb +2 -2
  7. data/lib/dynamoid/adapter_plugin/aws_sdk_v3/filter_expression_convertor.rb +113 -0
  8. data/lib/dynamoid/adapter_plugin/aws_sdk_v3/item_updater.rb +21 -2
  9. data/lib/dynamoid/adapter_plugin/aws_sdk_v3/projection_expression_convertor.rb +40 -0
  10. data/lib/dynamoid/adapter_plugin/aws_sdk_v3/query.rb +46 -61
  11. data/lib/dynamoid/adapter_plugin/aws_sdk_v3/scan.rb +34 -28
  12. data/lib/dynamoid/adapter_plugin/aws_sdk_v3/transact.rb +31 -0
  13. data/lib/dynamoid/adapter_plugin/aws_sdk_v3.rb +95 -66
  14. data/lib/dynamoid/associations/belongs_to.rb +6 -6
  15. data/lib/dynamoid/associations.rb +1 -1
  16. data/lib/dynamoid/components.rb +1 -0
  17. data/lib/dynamoid/config/options.rb +12 -12
  18. data/lib/dynamoid/config.rb +3 -0
  19. data/lib/dynamoid/criteria/chain.rb +149 -142
  20. data/lib/dynamoid/criteria/key_fields_detector.rb +6 -7
  21. data/lib/dynamoid/criteria/nonexistent_fields_detector.rb +2 -2
  22. data/lib/dynamoid/criteria/where_conditions.rb +36 -0
  23. data/lib/dynamoid/dirty.rb +87 -12
  24. data/lib/dynamoid/document.rb +1 -1
  25. data/lib/dynamoid/dumping.rb +38 -16
  26. data/lib/dynamoid/errors.rb +14 -2
  27. data/lib/dynamoid/fields/declare.rb +6 -6
  28. data/lib/dynamoid/fields.rb +6 -8
  29. data/lib/dynamoid/finders.rb +23 -32
  30. data/lib/dynamoid/indexes.rb +6 -7
  31. data/lib/dynamoid/loadable.rb +3 -2
  32. data/lib/dynamoid/persistence/inc.rb +6 -7
  33. data/lib/dynamoid/persistence/item_updater_with_casting_and_dumping.rb +36 -0
  34. data/lib/dynamoid/persistence/item_updater_with_dumping.rb +33 -0
  35. data/lib/dynamoid/persistence/save.rb +17 -18
  36. data/lib/dynamoid/persistence/update_fields.rb +7 -5
  37. data/lib/dynamoid/persistence/update_validations.rb +1 -1
  38. data/lib/dynamoid/persistence/upsert.rb +5 -4
  39. data/lib/dynamoid/persistence.rb +77 -21
  40. data/lib/dynamoid/transaction_write/base.rb +47 -0
  41. data/lib/dynamoid/transaction_write/create.rb +49 -0
  42. data/lib/dynamoid/transaction_write/delete_with_instance.rb +60 -0
  43. data/lib/dynamoid/transaction_write/delete_with_primary_key.rb +59 -0
  44. data/lib/dynamoid/transaction_write/destroy.rb +79 -0
  45. data/lib/dynamoid/transaction_write/save.rb +164 -0
  46. data/lib/dynamoid/transaction_write/update_attributes.rb +46 -0
  47. data/lib/dynamoid/transaction_write/update_fields.rb +102 -0
  48. data/lib/dynamoid/transaction_write/upsert.rb +96 -0
  49. data/lib/dynamoid/transaction_write.rb +464 -0
  50. data/lib/dynamoid/type_casting.rb +18 -15
  51. data/lib/dynamoid/undumping.rb +14 -3
  52. data/lib/dynamoid/validations.rb +1 -1
  53. data/lib/dynamoid/version.rb +1 -1
  54. data/lib/dynamoid.rb +7 -0
  55. metadata +30 -16
  56. data/lib/dynamoid/criteria/ignored_conditions_detector.rb +0 -41
  57. data/lib/dynamoid/criteria/overwritten_conditions_detector.rb +0 -40
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.9.0
4
+ version: 3.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Symonds
@@ -21,7 +21,7 @@ authors:
21
21
  autorequire:
22
22
  bindir: bin
23
23
  cert_chain: []
24
- date: 2023-04-13 00:00:00.000000000 Z
24
+ date: 2025-01-12 00:00:00.000000000 Z
25
25
  dependencies:
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: activemodel
@@ -122,33 +122,33 @@ dependencies:
122
122
  - !ruby/object:Gem::Version
123
123
  version: '13.0'
124
124
  - !ruby/object:Gem::Dependency
125
- name: rspec
125
+ name: rexml
126
126
  requirement: !ruby/object:Gem::Requirement
127
127
  requirements:
128
- - - "~>"
128
+ - - ">="
129
129
  - !ruby/object:Gem::Version
130
- version: '3.12'
130
+ version: '0'
131
131
  type: :development
132
132
  prerelease: false
133
133
  version_requirements: !ruby/object:Gem::Requirement
134
134
  requirements:
135
- - - "~>"
135
+ - - ">="
136
136
  - !ruby/object:Gem::Version
137
- version: '3.12'
137
+ version: '0'
138
138
  - !ruby/object:Gem::Dependency
139
- name: rubocop-lts
139
+ name: rspec
140
140
  requirement: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: '10.0'
144
+ version: '3.12'
145
145
  type: :development
146
146
  prerelease: false
147
147
  version_requirements: !ruby/object:Gem::Requirement
148
148
  requirements:
149
149
  - - "~>"
150
150
  - !ruby/object:Gem::Version
151
- version: '10.0'
151
+ version: '3.12'
152
152
  - !ruby/object:Gem::Dependency
153
153
  name: yard
154
154
  requirement: !ruby/object:Gem::Requirement
@@ -185,13 +185,16 @@ files:
185
185
  - lib/dynamoid/adapter_plugin/aws_sdk_v3/batch_get_item.rb
186
186
  - lib/dynamoid/adapter_plugin/aws_sdk_v3/create_table.rb
187
187
  - lib/dynamoid/adapter_plugin/aws_sdk_v3/execute_statement.rb
188
+ - lib/dynamoid/adapter_plugin/aws_sdk_v3/filter_expression_convertor.rb
188
189
  - lib/dynamoid/adapter_plugin/aws_sdk_v3/item_updater.rb
189
190
  - lib/dynamoid/adapter_plugin/aws_sdk_v3/middleware/backoff.rb
190
191
  - lib/dynamoid/adapter_plugin/aws_sdk_v3/middleware/limit.rb
191
192
  - lib/dynamoid/adapter_plugin/aws_sdk_v3/middleware/start_key.rb
193
+ - lib/dynamoid/adapter_plugin/aws_sdk_v3/projection_expression_convertor.rb
192
194
  - lib/dynamoid/adapter_plugin/aws_sdk_v3/query.rb
193
195
  - lib/dynamoid/adapter_plugin/aws_sdk_v3/scan.rb
194
196
  - lib/dynamoid/adapter_plugin/aws_sdk_v3/table.rb
197
+ - lib/dynamoid/adapter_plugin/aws_sdk_v3/transact.rb
195
198
  - lib/dynamoid/adapter_plugin/aws_sdk_v3/until_past_table_status.rb
196
199
  - lib/dynamoid/application_time_zone.rb
197
200
  - lib/dynamoid/associations.rb
@@ -209,10 +212,9 @@ files:
209
212
  - lib/dynamoid/config/options.rb
210
213
  - lib/dynamoid/criteria.rb
211
214
  - lib/dynamoid/criteria/chain.rb
212
- - lib/dynamoid/criteria/ignored_conditions_detector.rb
213
215
  - lib/dynamoid/criteria/key_fields_detector.rb
214
216
  - lib/dynamoid/criteria/nonexistent_fields_detector.rb
215
- - lib/dynamoid/criteria/overwritten_conditions_detector.rb
217
+ - lib/dynamoid/criteria/where_conditions.rb
216
218
  - lib/dynamoid/dirty.rb
217
219
  - lib/dynamoid/document.rb
218
220
  - lib/dynamoid/dumping.rb
@@ -229,6 +231,8 @@ files:
229
231
  - lib/dynamoid/persistence.rb
230
232
  - lib/dynamoid/persistence/import.rb
231
233
  - lib/dynamoid/persistence/inc.rb
234
+ - lib/dynamoid/persistence/item_updater_with_casting_and_dumping.rb
235
+ - lib/dynamoid/persistence/item_updater_with_dumping.rb
232
236
  - lib/dynamoid/persistence/save.rb
233
237
  - lib/dynamoid/persistence/update_fields.rb
234
238
  - lib/dynamoid/persistence/update_validations.rb
@@ -238,6 +242,16 @@ files:
238
242
  - lib/dynamoid/tasks.rb
239
243
  - lib/dynamoid/tasks/database.rake
240
244
  - lib/dynamoid/tasks/database.rb
245
+ - lib/dynamoid/transaction_write.rb
246
+ - lib/dynamoid/transaction_write/base.rb
247
+ - lib/dynamoid/transaction_write/create.rb
248
+ - lib/dynamoid/transaction_write/delete_with_instance.rb
249
+ - lib/dynamoid/transaction_write/delete_with_primary_key.rb
250
+ - lib/dynamoid/transaction_write/destroy.rb
251
+ - lib/dynamoid/transaction_write/save.rb
252
+ - lib/dynamoid/transaction_write/update_attributes.rb
253
+ - lib/dynamoid/transaction_write/update_fields.rb
254
+ - lib/dynamoid/transaction_write/upsert.rb
241
255
  - lib/dynamoid/type_casting.rb
242
256
  - lib/dynamoid/undumping.rb
243
257
  - lib/dynamoid/validations.rb
@@ -247,10 +261,10 @@ licenses:
247
261
  - MIT
248
262
  metadata:
249
263
  homepage_uri: http://github.com/Dynamoid/dynamoid
250
- source_code_uri: https://github.com/Dynamoid/dynamoid/tree/v3.9.0
251
- changelog_uri: https://github.com/Dynamoid/dynamoid/blob/v3.9.0/CHANGELOG.md
264
+ source_code_uri: https://github.com/Dynamoid/dynamoid/tree/v3.11.0
265
+ changelog_uri: https://github.com/Dynamoid/dynamoid/blob/v3.11.0/CHANGELOG.md
252
266
  bug_tracker_uri: https://github.com/Dynamoid/dynamoid/issues
253
- documentation_uri: https://www.rubydoc.info/gems/dynamoid/3.9.0
267
+ documentation_uri: https://www.rubydoc.info/gems/dynamoid/3.11.0
254
268
  funding_uri: https://opencollective.com/dynamoid
255
269
  wiki_uri: https://github.com/Dynamoid/dynamoid/wiki
256
270
  rubygems_mfa_required: 'true'
@@ -269,7 +283,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
269
283
  - !ruby/object:Gem::Version
270
284
  version: '0'
271
285
  requirements: []
272
- rubygems_version: 3.4.6
286
+ rubygems_version: 3.5.3
273
287
  signing_key:
274
288
  specification_version: 4
275
289
  summary: Dynamoid is an ORM for Amazon's DynamoDB
@@ -1,41 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Dynamoid
4
- module Criteria
5
- # @private
6
- class IgnoredConditionsDetector
7
- def initialize(conditions)
8
- @conditions = conditions
9
- @ignored_keys = ignored_keys
10
- end
11
-
12
- def found?
13
- @ignored_keys.present?
14
- end
15
-
16
- def warning_message
17
- return unless found?
18
-
19
- 'Where conditions may contain only one condition for an attribute. ' \
20
- "Following conditions are ignored: #{ignored_conditions}"
21
- end
22
-
23
- private
24
-
25
- def ignored_keys
26
- @conditions.keys
27
- .group_by(&method(:key_to_field))
28
- .select { |_, ary| ary.size > 1 }
29
- .flat_map { |_, ary| ary[0..-2] }
30
- end
31
-
32
- def key_to_field(key)
33
- key.to_s.split('.')[0]
34
- end
35
-
36
- def ignored_conditions
37
- @conditions.slice(*@ignored_keys)
38
- end
39
- end
40
- end
41
- end
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Dynamoid
4
- module Criteria
5
- # @private
6
- class OverwrittenConditionsDetector
7
- def initialize(conditions, conditions_new)
8
- @conditions = conditions
9
- @new_conditions = conditions_new
10
- @overwritten_keys = overwritten_keys
11
- end
12
-
13
- def found?
14
- @overwritten_keys.present?
15
- end
16
-
17
- def warning_message
18
- return unless found?
19
-
20
- 'Where conditions may contain only one condition for an attribute. ' \
21
- "Following conditions are ignored: #{ignored_conditions}"
22
- end
23
-
24
- private
25
-
26
- def overwritten_keys
27
- new_fields = @new_conditions.keys.map(&method(:key_to_field))
28
- @conditions.keys.select { |key| key_to_field(key).in?(new_fields) }
29
- end
30
-
31
- def key_to_field(key)
32
- key.to_s.split('.')[0]
33
- end
34
-
35
- def ignored_conditions
36
- @conditions.slice(*@overwritten_keys.map(&:to_sym))
37
- end
38
- end
39
- end
40
- end