dynamoid 3.5.0 → 3.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +35 -4
- data/README.md +24 -18
- data/lib/dynamoid.rb +1 -0
- data/lib/dynamoid/adapter.rb +7 -4
- data/lib/dynamoid/adapter_plugin/aws_sdk_v3.rb +14 -11
- data/lib/dynamoid/adapter_plugin/aws_sdk_v3/batch_get_item.rb +1 -0
- data/lib/dynamoid/adapter_plugin/aws_sdk_v3/create_table.rb +8 -7
- data/lib/dynamoid/adapter_plugin/aws_sdk_v3/item_updater.rb +3 -2
- data/lib/dynamoid/adapter_plugin/aws_sdk_v3/middleware/backoff.rb +1 -0
- data/lib/dynamoid/adapter_plugin/aws_sdk_v3/middleware/limit.rb +1 -0
- data/lib/dynamoid/adapter_plugin/aws_sdk_v3/middleware/start_key.rb +1 -0
- data/lib/dynamoid/adapter_plugin/aws_sdk_v3/query.rb +1 -0
- data/lib/dynamoid/adapter_plugin/aws_sdk_v3/scan.rb +1 -0
- data/lib/dynamoid/adapter_plugin/aws_sdk_v3/table.rb +1 -0
- data/lib/dynamoid/adapter_plugin/aws_sdk_v3/until_past_table_status.rb +1 -0
- data/lib/dynamoid/application_time_zone.rb +1 -0
- data/lib/dynamoid/associations.rb +182 -19
- data/lib/dynamoid/associations/association.rb +4 -2
- data/lib/dynamoid/associations/belongs_to.rb +2 -1
- data/lib/dynamoid/associations/has_and_belongs_to_many.rb +2 -1
- data/lib/dynamoid/associations/has_many.rb +2 -1
- data/lib/dynamoid/associations/has_one.rb +2 -1
- data/lib/dynamoid/associations/many_association.rb +65 -22
- data/lib/dynamoid/associations/single_association.rb +28 -1
- data/lib/dynamoid/components.rb +1 -0
- data/lib/dynamoid/config.rb +3 -2
- data/lib/dynamoid/config/backoff_strategies/constant_backoff.rb +1 -0
- data/lib/dynamoid/config/backoff_strategies/exponential_backoff.rb +1 -0
- data/lib/dynamoid/config/options.rb +1 -0
- data/lib/dynamoid/criteria.rb +1 -0
- data/lib/dynamoid/criteria/chain.rb +353 -33
- data/lib/dynamoid/criteria/ignored_conditions_detector.rb +1 -0
- data/lib/dynamoid/criteria/key_fields_detector.rb +10 -1
- data/lib/dynamoid/criteria/nonexistent_fields_detector.rb +1 -0
- data/lib/dynamoid/criteria/overwritten_conditions_detector.rb +1 -0
- data/lib/dynamoid/dirty.rb +71 -16
- data/lib/dynamoid/document.rb +123 -42
- data/lib/dynamoid/dumping.rb +9 -0
- data/lib/dynamoid/dynamodb_time_zone.rb +1 -0
- data/lib/dynamoid/fields.rb +189 -16
- data/lib/dynamoid/finders.rb +65 -28
- data/lib/dynamoid/identity_map.rb +6 -0
- data/lib/dynamoid/indexes.rb +74 -15
- data/lib/dynamoid/log/formatter.rb +26 -0
- data/lib/dynamoid/middleware/identity_map.rb +1 -0
- data/lib/dynamoid/persistence.rb +452 -106
- data/lib/dynamoid/persistence/import.rb +1 -0
- data/lib/dynamoid/persistence/save.rb +1 -0
- data/lib/dynamoid/persistence/update_fields.rb +1 -0
- data/lib/dynamoid/persistence/upsert.rb +1 -0
- data/lib/dynamoid/primary_key_type_mapping.rb +1 -0
- data/lib/dynamoid/railtie.rb +1 -0
- data/lib/dynamoid/tasks/database.rb +1 -0
- data/lib/dynamoid/type_casting.rb +12 -0
- data/lib/dynamoid/undumping.rb +8 -0
- data/lib/dynamoid/validations.rb +2 -0
- data/lib/dynamoid/version.rb +1 -1
- metadata +7 -19
data/lib/dynamoid/railtie.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Dynamoid
|
4
|
+
# @private
|
4
5
|
module TypeCasting
|
5
6
|
def self.cast_attributes(attributes, attributes_options)
|
6
7
|
{}.tap do |h|
|
@@ -35,6 +36,7 @@ module Dynamoid
|
|
35
36
|
when :raw then RawTypeCaster
|
36
37
|
when :serialized then SerializedTypeCaster
|
37
38
|
when :boolean then BooleanTypeCaster
|
39
|
+
when :binary then BinaryTypeCaster
|
38
40
|
when Class then CustomTypeCaster
|
39
41
|
end
|
40
42
|
|
@@ -283,6 +285,16 @@ module Dynamoid
|
|
283
285
|
end
|
284
286
|
end
|
285
287
|
|
288
|
+
class BinaryTypeCaster < Base
|
289
|
+
def process(value)
|
290
|
+
if value.is_a? String
|
291
|
+
value.dup
|
292
|
+
else
|
293
|
+
value.to_s
|
294
|
+
end
|
295
|
+
end
|
296
|
+
end
|
297
|
+
|
286
298
|
class CustomTypeCaster < Base
|
287
299
|
end
|
288
300
|
end
|
data/lib/dynamoid/undumping.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Dynamoid
|
4
|
+
# @private
|
4
5
|
module Undumping
|
5
6
|
def self.undump_attributes(attributes, attributes_options)
|
6
7
|
{}.tap do |h|
|
@@ -38,6 +39,7 @@ module Dynamoid
|
|
38
39
|
when :raw then RawUndumper
|
39
40
|
when :serialized then SerializedUndumper
|
40
41
|
when :boolean then BooleanUndumper
|
42
|
+
when :binary then BinaryUndumper
|
41
43
|
when Class then CustomTypeUndumper
|
42
44
|
end
|
43
45
|
|
@@ -262,6 +264,12 @@ module Dynamoid
|
|
262
264
|
end
|
263
265
|
end
|
264
266
|
|
267
|
+
class BinaryUndumper < Base
|
268
|
+
def process(value)
|
269
|
+
Base64.strict_decode64(value)
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
265
273
|
class CustomTypeUndumper < Base
|
266
274
|
def process(value)
|
267
275
|
field_class = @options[:type]
|
data/lib/dynamoid/validations.rb
CHANGED
@@ -10,6 +10,7 @@ module Dynamoid
|
|
10
10
|
|
11
11
|
# Override save to provide validation support.
|
12
12
|
#
|
13
|
+
# @private
|
13
14
|
# @since 0.2.0
|
14
15
|
def save(options = {})
|
15
16
|
options.reverse_merge!(validate: true)
|
@@ -28,6 +29,7 @@ module Dynamoid
|
|
28
29
|
|
29
30
|
# Raise an error unless this object is valid.
|
30
31
|
#
|
32
|
+
# @private
|
31
33
|
# @since 0.2.0
|
32
34
|
def save!
|
33
35
|
raise Dynamoid::Errors::DocumentNotValid, self unless valid?
|
data/lib/dynamoid/version.rb
CHANGED
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.
|
4
|
+
version: 3.6.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: 2020-
|
24
|
+
date: 2020-07-13 00:00:00.000000000 Z
|
25
25
|
dependencies:
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: activemodel
|
@@ -65,20 +65,6 @@ dependencies:
|
|
65
65
|
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '1.0'
|
68
|
-
- !ruby/object:Gem::Dependency
|
69
|
-
name: null-logger
|
70
|
-
requirement: !ruby/object:Gem::Requirement
|
71
|
-
requirements:
|
72
|
-
- - ">="
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version: '0'
|
75
|
-
type: :runtime
|
76
|
-
prerelease: false
|
77
|
-
version_requirements: !ruby/object:Gem::Requirement
|
78
|
-
requirements:
|
79
|
-
- - ">="
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: '0'
|
82
68
|
- !ruby/object:Gem::Dependency
|
83
69
|
name: appraisal
|
84
70
|
requirement: !ruby/object:Gem::Requirement
|
@@ -262,6 +248,7 @@ files:
|
|
262
248
|
- lib/dynamoid/identity_map.rb
|
263
249
|
- lib/dynamoid/indexes.rb
|
264
250
|
- lib/dynamoid/loadable.rb
|
251
|
+
- lib/dynamoid/log/formatter.rb
|
265
252
|
- lib/dynamoid/middleware/identity_map.rb
|
266
253
|
- lib/dynamoid/persistence.rb
|
267
254
|
- lib/dynamoid/persistence/import.rb
|
@@ -282,8 +269,9 @@ licenses:
|
|
282
269
|
- MIT
|
283
270
|
metadata:
|
284
271
|
bug_tracker_uri: https://github.com/Dynamoid/dynamoid/issues
|
285
|
-
changelog_uri: https://github.com/Dynamoid/dynamoid/
|
286
|
-
source_code_uri: https://github.com/Dynamoid/dynamoid/tree/v3.
|
272
|
+
changelog_uri: https://github.com/Dynamoid/dynamoid/tree/v3.6.0/CHANGELOG.md
|
273
|
+
source_code_uri: https://github.com/Dynamoid/dynamoid/tree/v3.6.0
|
274
|
+
documentation_uri: https://rubydoc.info/gems/dynamoid/3.6.0
|
287
275
|
post_install_message:
|
288
276
|
rdoc_options: []
|
289
277
|
require_paths:
|
@@ -299,7 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
299
287
|
- !ruby/object:Gem::Version
|
300
288
|
version: '0'
|
301
289
|
requirements: []
|
302
|
-
rubygems_version: 3.
|
290
|
+
rubygems_version: 3.1.2
|
303
291
|
signing_key:
|
304
292
|
specification_version: 4
|
305
293
|
summary: Dynamoid is an ORM for Amazon's DynamoDB
|