aws-dynamodb-query 0.1.8 → 0.1.9
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/.idea/aws-dynamodb-query.iml +3 -3
- data/.idea/workspace.xml +39 -34
- data/lib/aws/dynamodb/query.rb +18 -3
- data/lib/aws/dynamodb/query/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: c5aa6ff7dae58a17c67ee751b17fa6dc704a44f4
|
4
|
+
data.tar.gz: 0d5ad84888b9e831b46e7a447ce5321d6c24e8bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90620d0560f68033b6fc69bb75df2f23cca8bfcdcf093b8e32b147b1097439478f086de04d82bbe2c166bc6cb16d5452d25743e5ae776d78cfcae59706559a72
|
7
|
+
data.tar.gz: 351ad7c97d9fc92876296cfbd78b7be824d2e2d0b9c21bbce694e5461186cc8dd0c60aab5fbb28ad712c40a0b604b8072057bb50a6382b388b836f4820bb90bd
|
@@ -8,9 +8,9 @@
|
|
8
8
|
<orderEntry type="jdk" jdkName="RVM: ruby-2.3.0" jdkType="RUBY_SDK" />
|
9
9
|
<orderEntry type="sourceFolder" forTests="false" />
|
10
10
|
<orderEntry type="library" scope="PROVIDED" name="aws-signature-v4 (v0.1.0, RVM: ruby-2.3.0) [gem]" level="application" />
|
11
|
-
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.
|
11
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.16.0, RVM: ruby-2.3.0) [gem]" level="application" />
|
12
12
|
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.10.3, RVM: ruby-2.3.0) [gem]" level="application" />
|
13
|
-
<orderEntry type="library" scope="PROVIDED" name="rake (v10.
|
14
|
-
<orderEntry type="library" scope="PROVIDED" name="yajl-ruby (v1.3.
|
13
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, RVM: ruby-2.3.0) [gem]" level="application" />
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="yajl-ruby (v1.3.1, RVM: ruby-2.3.0) [gem]" level="application" />
|
15
15
|
</component>
|
16
16
|
</module>
|
data/.idea/workspace.xml
CHANGED
@@ -37,8 +37,8 @@
|
|
37
37
|
<file leaf-file-name="query.rb" pinned="false" current-in-tab="false">
|
38
38
|
<entry file="file://$PROJECT_DIR$/lib/aws/dynamodb/query.rb">
|
39
39
|
<provider selected="true" editor-type-id="text-editor">
|
40
|
-
<state relative-caret-position="
|
41
|
-
<caret line="
|
40
|
+
<state relative-caret-position="45">
|
41
|
+
<caret line="3" column="18" lean-forward="true" selection-start-line="3" selection-start-column="18" selection-end-line="3" selection-end-column="18" />
|
42
42
|
<folding />
|
43
43
|
</state>
|
44
44
|
</provider>
|
@@ -47,8 +47,8 @@
|
|
47
47
|
<file leaf-file-name="v4.rb" pinned="false" current-in-tab="false">
|
48
48
|
<entry file="file://$USER_HOME$/.rvm/gems/ruby-2.3.0/gems/aws-signature-v4-0.1.0/lib/aws/signature/v4.rb">
|
49
49
|
<provider selected="true" editor-type-id="text-editor">
|
50
|
-
<state relative-caret-position="
|
51
|
-
<caret line="
|
50
|
+
<state relative-caret-position="136">
|
51
|
+
<caret line="8" column="22" lean-forward="false" selection-start-line="8" selection-start-column="22" selection-end-line="8" selection-end-column="22" />
|
52
52
|
<folding />
|
53
53
|
</state>
|
54
54
|
</provider>
|
@@ -67,8 +67,8 @@
|
|
67
67
|
<file leaf-file-name="Gemfile" pinned="false" current-in-tab="false">
|
68
68
|
<entry file="file://$PROJECT_DIR$/Gemfile">
|
69
69
|
<provider selected="true" editor-type-id="text-editor">
|
70
|
-
<state relative-caret-position="
|
71
|
-
<caret line="
|
70
|
+
<state relative-caret-position="135">
|
71
|
+
<caret line="9" column="21" lean-forward="false" selection-start-line="9" selection-start-column="21" selection-end-line="9" selection-end-column="21" />
|
72
72
|
<folding />
|
73
73
|
</state>
|
74
74
|
</provider>
|
@@ -100,8 +100,8 @@
|
|
100
100
|
<file leaf-file-name="aws-dynamodb-query.gemspec" pinned="false" current-in-tab="false">
|
101
101
|
<entry file="file://$PROJECT_DIR$/aws-dynamodb-query.gemspec">
|
102
102
|
<provider selected="true" editor-type-id="text-editor">
|
103
|
-
<state relative-caret-position="
|
104
|
-
<caret line="
|
103
|
+
<state relative-caret-position="165">
|
104
|
+
<caret line="11" column="63" lean-forward="false" selection-start-line="11" selection-start-column="63" selection-end-line="11" selection-end-column="63" />
|
105
105
|
<folding />
|
106
106
|
</state>
|
107
107
|
</provider>
|
@@ -111,11 +111,6 @@
|
|
111
111
|
</component>
|
112
112
|
<component name="FindInProjectRecents">
|
113
113
|
<findStrings>
|
114
|
-
<find>rubo</find>
|
115
|
-
<find>files</find>
|
116
|
-
<find>sig</find>
|
117
|
-
<find>ENV</find>
|
118
|
-
<find>last_evaluated_key</find>
|
119
114
|
<find>pagination</find>
|
120
115
|
<find>@secret_key</find>
|
121
116
|
<find>aws_access_key_id</find>
|
@@ -139,6 +134,13 @@
|
|
139
134
|
<find>unset_attributes</find>
|
140
135
|
<find>stored_attributes</find>
|
141
136
|
<find>Agent</find>
|
137
|
+
<find>json</find>
|
138
|
+
<find>dynamodb_data_types = %w[S BOOL BS L M N NS NULL S SS]</find>
|
139
|
+
<find>key_dasherized = key.to_s.dasherize</find>
|
140
|
+
<find>dynamodb_data_types.each do |data_type|</find>
|
141
|
+
<find>record[key_dasherized] = record[key_dasherized] || item[key][data_type]</find>
|
142
|
+
<find>attribute_keys</find>
|
143
|
+
<find>attributes</find>
|
142
144
|
</findStrings>
|
143
145
|
</component>
|
144
146
|
<component name="Git.Settings">
|
@@ -163,11 +165,10 @@
|
|
163
165
|
<detection-done>true</detection-done>
|
164
166
|
<sorting>DEFINITION_ORDER</sorting>
|
165
167
|
</component>
|
166
|
-
<component name="ProjectFrameBounds">
|
167
|
-
<option name="x" value="
|
168
|
-
<option name="
|
169
|
-
<option name="
|
170
|
-
<option name="height" value="1344" />
|
168
|
+
<component name="ProjectFrameBounds" fullScreen="true">
|
169
|
+
<option name="x" value="1130" />
|
170
|
+
<option name="width" value="1430" />
|
171
|
+
<option name="height" value="1440" />
|
171
172
|
</component>
|
172
173
|
<component name="ProjectInspectionProfilesVisibleTreeState">
|
173
174
|
<entry key="Project Default">
|
@@ -298,7 +299,11 @@
|
|
298
299
|
<workItem from="1509616590154" duration="38000" />
|
299
300
|
<workItem from="1509621829777" duration="713000" />
|
300
301
|
<workItem from="1509625297566" duration="1234000" />
|
301
|
-
<workItem from="1509627738661" duration="
|
302
|
+
<workItem from="1509627738661" duration="2624000" />
|
303
|
+
<workItem from="1509691695668" duration="1603000" />
|
304
|
+
<workItem from="1510049148369" duration="1870000" />
|
305
|
+
<workItem from="1510132643711" duration="254000" />
|
306
|
+
<workItem from="1510312325679" duration="531000" />
|
302
307
|
</task>
|
303
308
|
<task id="LOCAL-00001" summary="First working release 0.1.1">
|
304
309
|
<created>1509537033535</created>
|
@@ -325,18 +330,16 @@
|
|
325
330
|
<servers />
|
326
331
|
</component>
|
327
332
|
<component name="TimeTrackingManager">
|
328
|
-
<option name="totallyTimeSpent" value="
|
333
|
+
<option name="totallyTimeSpent" value="25198000" />
|
329
334
|
</component>
|
330
335
|
<component name="ToolWindowManager">
|
331
|
-
<frame x="
|
336
|
+
<frame x="1130" y="0" width="1430" height="1440" extended-state="0" />
|
332
337
|
<editor active="true" />
|
333
338
|
<layout>
|
334
339
|
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.18358113" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
335
340
|
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
336
341
|
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3599374" sideWeight="0.5159151" order="7" side_tool="true" content_ui="tabs" />
|
337
|
-
<window_info id="Inspection Results" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32942098" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
338
342
|
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
339
|
-
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
340
343
|
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3599374" sideWeight="0.48408487" order="7" side_tool="false" content_ui="tabs" />
|
341
344
|
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25931233" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
342
345
|
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
@@ -349,6 +352,8 @@
|
|
349
352
|
<window_info id="Documentation" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="FLOATING" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" x="100" y="100" width="1476" height="1240" />
|
350
353
|
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
351
354
|
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
|
355
|
+
<window_info id="Inspection Results" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32942098" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
|
356
|
+
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
352
357
|
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
353
358
|
</layout>
|
354
359
|
</component>
|
@@ -745,34 +750,34 @@
|
|
745
750
|
</state>
|
746
751
|
</provider>
|
747
752
|
</entry>
|
748
|
-
<entry file="file://$
|
753
|
+
<entry file="file://$PROJECT_DIR$/aws-dynamodb-query.gemspec">
|
749
754
|
<provider selected="true" editor-type-id="text-editor">
|
750
|
-
<state relative-caret-position="
|
751
|
-
<caret line="
|
755
|
+
<state relative-caret-position="165">
|
756
|
+
<caret line="11" column="63" lean-forward="false" selection-start-line="11" selection-start-column="63" selection-end-line="11" selection-end-column="63" />
|
752
757
|
<folding />
|
753
758
|
</state>
|
754
759
|
</provider>
|
755
760
|
</entry>
|
756
|
-
<entry file="file://$PROJECT_DIR$/
|
761
|
+
<entry file="file://$PROJECT_DIR$/Gemfile">
|
757
762
|
<provider selected="true" editor-type-id="text-editor">
|
758
|
-
<state relative-caret-position="
|
759
|
-
<caret line="
|
763
|
+
<state relative-caret-position="135">
|
764
|
+
<caret line="9" column="21" lean-forward="false" selection-start-line="9" selection-start-column="21" selection-end-line="9" selection-end-column="21" />
|
760
765
|
<folding />
|
761
766
|
</state>
|
762
767
|
</provider>
|
763
768
|
</entry>
|
764
|
-
<entry file="file://$
|
769
|
+
<entry file="file://$USER_HOME$/.rvm/gems/ruby-2.3.0/gems/aws-signature-v4-0.1.0/lib/aws/signature/v4.rb">
|
765
770
|
<provider selected="true" editor-type-id="text-editor">
|
766
|
-
<state relative-caret-position="
|
767
|
-
<caret line="
|
771
|
+
<state relative-caret-position="136">
|
772
|
+
<caret line="8" column="22" lean-forward="false" selection-start-line="8" selection-start-column="22" selection-end-line="8" selection-end-column="22" />
|
768
773
|
<folding />
|
769
774
|
</state>
|
770
775
|
</provider>
|
771
776
|
</entry>
|
772
777
|
<entry file="file://$PROJECT_DIR$/lib/aws/dynamodb/query.rb">
|
773
778
|
<provider selected="true" editor-type-id="text-editor">
|
774
|
-
<state relative-caret-position="
|
775
|
-
<caret line="
|
779
|
+
<state relative-caret-position="45">
|
780
|
+
<caret line="3" column="18" lean-forward="true" selection-start-line="3" selection-start-column="18" selection-end-line="3" selection-end-column="18" />
|
776
781
|
<folding />
|
777
782
|
</state>
|
778
783
|
</provider>
|
data/lib/aws/dynamodb/query.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'aws/dynamodb/query/version'
|
2
2
|
require 'aws/signature/v4'
|
3
3
|
require 'yajl'
|
4
|
+
require 'net/http'
|
4
5
|
|
5
6
|
module Aws
|
6
7
|
module Dynamodb
|
@@ -32,6 +33,7 @@ module Aws
|
|
32
33
|
def self.call(table_name,
|
33
34
|
model_class: nil,
|
34
35
|
nullify_model_attributes: false,
|
36
|
+
result_type: Struct,
|
35
37
|
index_name: nil,
|
36
38
|
select: nil,
|
37
39
|
key_condition_expression: nil,
|
@@ -90,6 +92,9 @@ module Aws
|
|
90
92
|
return result
|
91
93
|
end
|
92
94
|
|
95
|
+
# Create DAO struct object <struct Struct::Customer id>
|
96
|
+
Struct.new('AwsDynamodbQueryDAO', *model_class.attributes.attributes.keys) if result_type.eql? Struct
|
97
|
+
|
93
98
|
# success => parse returned json
|
94
99
|
json = Yajl::Parser.new.parse(res.body)
|
95
100
|
|
@@ -110,14 +115,24 @@ module Aws
|
|
110
115
|
end
|
111
116
|
|
112
117
|
# nullify remaining model attributes to be included in returned result
|
113
|
-
if nullify_model_attributes and model_class.respond_to? :
|
114
|
-
unset_attributes = model_class.
|
118
|
+
if nullify_model_attributes and model_class.respond_to? :attributes
|
119
|
+
unset_attributes = model_class.attributes.attributes.keys - stored_attributes
|
115
120
|
unset_attributes.each do |attr|
|
116
121
|
record[attr.to_s.dasherize] = nil
|
117
122
|
end
|
118
123
|
end
|
119
124
|
|
120
|
-
|
125
|
+
case result_type.to_s
|
126
|
+
when Struct.to_s
|
127
|
+
# order values in the same order as model attribute_keys
|
128
|
+
attribute_values = []
|
129
|
+
model_class.attributes.attributes.keys.each do |attribute_key|
|
130
|
+
attribute_values << record[attribute_key.to_s.dasherize]
|
131
|
+
end
|
132
|
+
result << Struct::AwsDynamodbQueryDAO.new(*attribute_values)
|
133
|
+
else
|
134
|
+
result << record
|
135
|
+
end
|
121
136
|
end
|
122
137
|
|
123
138
|
# LastEvaluatedKey in the response indicates that not all of the items have been retrieved.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-dynamodb-query
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- khaled83
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|