appfuel 0.6.5 → 0.6.6
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/CHANGELOG.md +4 -0
- data/lib/appfuel/storage/dynamodb/adapter.rb +43 -1
- data/lib/appfuel/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c62c1dda23c68cc94510cc7d066289d8096ccec4
|
4
|
+
data.tar.gz: 38778f084abf8373397920e12b2fbe7d90ec1567
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8b4f1093b76c7be1b9c6db79cc0a6ae40fc085c8f99cb2ed78c4eabda6fe6646c9f71ea8627dcf9e8726feac5cdde8d0a2d9098ce53dee5a0b4b427a4ff27a9
|
7
|
+
data.tar.gz: 7976bd1967ce72901ac38491b4e775c87a15e084b21386b96ea91d626934c1cf6f445b2cc226084e0c1fca4c6d009e42bb43885a94e6d40dfd007e817e9dea0f
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. (Pending ap
|
|
5
5
|
|
6
6
|
|
7
7
|
# Releases
|
8
|
+
## [[0.6.6]](https://github.com/rsb/appfuel/releases/tag/0.6.6) 2017-08-23
|
9
|
+
### Added
|
10
|
+
- `batch_get` to dynamodb nosql adapter
|
11
|
+
|
8
12
|
## [[0.6.5]](https://github.com/rsb/appfuel/releases/tag/0.6.5) 2017-08-21
|
9
13
|
### Added
|
10
14
|
- basic table query interface for dynamodb nosql adapter
|
@@ -101,7 +101,6 @@ module Appfuel
|
|
101
101
|
self.class.primary_key
|
102
102
|
end
|
103
103
|
|
104
|
-
|
105
104
|
def put_params(data)
|
106
105
|
create_table_hash(item: data)
|
107
106
|
end
|
@@ -152,6 +151,49 @@ module Appfuel
|
|
152
151
|
client.query(params)
|
153
152
|
end
|
154
153
|
|
154
|
+
def batch_keys(ids)
|
155
|
+
fail "ids must response to :map" unless ids.respond_to?(:map)
|
156
|
+
key = primary_key
|
157
|
+
ids.map do |id|
|
158
|
+
hash_value, range_value = id.is_a?(Array)? id : [id, nil]
|
159
|
+
key.params(hash_value, range_value)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
# build batch keys
|
164
|
+
# when inputs is an array of one item
|
165
|
+
# when the inputs is an array of two items
|
166
|
+
#
|
167
|
+
# requested_items: {
|
168
|
+
# "TableName" => {
|
169
|
+
# keys: [
|
170
|
+
#
|
171
|
+
# ]
|
172
|
+
# }
|
173
|
+
# }
|
174
|
+
#
|
175
|
+
#
|
176
|
+
def batch_get(ids, &block)
|
177
|
+
table_key = table_name
|
178
|
+
result = client.batch_get_item(
|
179
|
+
request_items: {
|
180
|
+
table_key => { keys: batch_keys(ids) }
|
181
|
+
}
|
182
|
+
)
|
183
|
+
|
184
|
+
|
185
|
+
unless result.responses.key?(table_key)
|
186
|
+
fail "db table name #{table_key} is not correct"
|
187
|
+
end
|
188
|
+
|
189
|
+
list = result.responses[table_key]
|
190
|
+
return list if block_given?
|
191
|
+
|
192
|
+
list.each do |item|
|
193
|
+
yield item
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
155
197
|
def put(data)
|
156
198
|
params = put_params(data)
|
157
199
|
client.put_item(params)
|
data/lib/appfuel/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appfuel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Scott-Buccleuch
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|