tiny_dyno 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +7 -0
- data/lib/tiny_dyno/persistable.rb +39 -39
- data/lib/tiny_dyno/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dad49629c87d23c41034877a01393def956c568e
|
4
|
+
data.tar.gz: 0e6ceca28ce34d7c53a8ed3ad4e9c75b531d8036
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b0ceaaf98b68e1f216f93099aa5ee8749145a561b7e729bc92be64668894cc6fee883f6cfd7d28ca232941e0059e28f583cec51dc1cbda3d61cadbb37694527
|
7
|
+
data.tar.gz: 47f32b1f3d66bc0128b505a5a64c6f971987a16490489bd9abef230e9689e6d4d1c0d6d3b796c8ff474c0f9c93c010197b0b2dfa4f73abbe3bb17f93d14d71b1
|
data/CHANGES.md
CHANGED
@@ -1,4 +1,11 @@
|
|
1
|
+
0.1.11 (2015-07-04)
|
2
|
+
-------------------
|
3
|
+
|
4
|
+
* Fix - retract update_item support
|
5
|
+
Instead add a modified put operation, which will overwrite an entire record, when saving an update to an already existing object
|
6
|
+
|
1
7
|
0.1.10 (2015-07-04)
|
8
|
+
-------------------
|
2
9
|
|
3
10
|
* New - (basic) update_item support, for atomic PUT and DELETE actions, no support for ADD action yet
|
4
11
|
|
@@ -12,7 +12,7 @@ module TinyDyno
|
|
12
12
|
return false
|
13
13
|
end
|
14
14
|
else
|
15
|
-
if
|
15
|
+
if request_replace_item(options)
|
16
16
|
changes_applied
|
17
17
|
return true
|
18
18
|
else
|
@@ -28,9 +28,9 @@ module TinyDyno
|
|
28
28
|
return(TinyDyno::Adapter.put_item(put_item_request: request))
|
29
29
|
end
|
30
30
|
|
31
|
-
def
|
32
|
-
request =
|
33
|
-
return(TinyDyno::Adapter.
|
31
|
+
def request_replace_item(options)
|
32
|
+
request = build_put_item_request
|
33
|
+
return(TinyDyno::Adapter.put_item(put_item_request: request))
|
34
34
|
end
|
35
35
|
|
36
36
|
def build_put_item_request
|
@@ -40,13 +40,13 @@ module TinyDyno
|
|
40
40
|
}
|
41
41
|
end
|
42
42
|
|
43
|
-
def build_update_item_request
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
end
|
43
|
+
# def build_update_item_request
|
44
|
+
# {
|
45
|
+
# key: hash_key_as_selector,
|
46
|
+
# table_name: self.class.table_name,
|
47
|
+
# attribute_updates: build_attribute_updates
|
48
|
+
# }
|
49
|
+
# end
|
50
50
|
|
51
51
|
def build_item_request_entries
|
52
52
|
item_entries = {}
|
@@ -59,34 +59,34 @@ module TinyDyno
|
|
59
59
|
# value: "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
|
60
60
|
# action: "ADD", # accepts ADD, PUT, DELETE
|
61
61
|
# },
|
62
|
-
def build_attribute_updates
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
end
|
62
|
+
# def build_attribute_updates
|
63
|
+
# change_record = []
|
64
|
+
# changes.keys.each do |change_key|
|
65
|
+
# if self.class.attribute_names.include?(change_key)
|
66
|
+
# change_record << {:"#{ change_key}" => changes[change_key]}
|
67
|
+
# end
|
68
|
+
# end
|
69
|
+
# # keep this simple for now
|
70
|
+
# # I don't see (yet) how to map the possible operations on dynamodb items
|
71
|
+
# # into activerecord compatible schemas
|
72
|
+
# # extend as use cases arise
|
73
|
+
# # specification by example ...
|
74
|
+
# attribute_updates = {}
|
75
|
+
# change_record.each do |change|
|
76
|
+
# change_key = change.keys.first
|
77
|
+
# if change[change_key][1].nil?
|
78
|
+
# attribute_updates[change_key] = {
|
79
|
+
# action: 'DELETE'
|
80
|
+
# }
|
81
|
+
# else
|
82
|
+
# attribute_updates[change_key] = {
|
83
|
+
# value: change[change_key][1],
|
84
|
+
# action: 'PUT'
|
85
|
+
# }
|
86
|
+
# end
|
87
|
+
# end
|
88
|
+
# attribute_updates
|
89
|
+
# end
|
90
90
|
|
91
91
|
module ClassMethods
|
92
92
|
|
data/lib/tiny_dyno/version.rb
CHANGED