aws-dynamodb-query 0.1.0
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 +7 -0
- data/.gitignore +9 -0
- data/.idea/aws-dynamodb-query.iml +15 -0
- data/.idea/encodings.xml +6 -0
- data/.idea/misc.xml +4 -0
- data/.idea/modules.xml +8 -0
- data/.idea/workspace.xml +368 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +74 -0
- data/Rakefile +10 -0
- data/aws-dynamodb-query.gemspec +36 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/aws/dynamodb/query.rb +115 -0
- data/lib/aws/dynamodb/query/version.rb +7 -0
- metadata +105 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: db936f010206aa89f3d38f3ae1985b5d03239200
|
4
|
+
data.tar.gz: 03447e7cd067b90bc60bbca3835b8cfade3ed4be
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8b1d5f92324043fbcd57f0b5dcc7b4084d877dd9457372bf77b61dfc02da8a03fe64e71c622257f2a793433ad7c19921dd0e4f4142f90c4804432d239aa97a66
|
7
|
+
data.tar.gz: b00177c235d49a1a3fe47cb79b72a1f731db151f16fcb551adc9e500397e8df5a424c006b892fbfcb264f8c85e7cbfe0936f31820ebf894b4de8d92601041b85
|
data/.gitignore
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
4
|
+
<shared />
|
5
|
+
</component>
|
6
|
+
<component name="NewModuleRootManager">
|
7
|
+
<content url="file://$MODULE_DIR$" />
|
8
|
+
<orderEntry type="jdk" jdkName="RVM: ruby-2.3.0" jdkType="RUBY_SDK" />
|
9
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
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.14.3, RVM: ruby-2.3.0) [gem]" level="application" />
|
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.4.2, RVM: ruby-2.3.0) [gem]" level="application" />
|
14
|
+
</component>
|
15
|
+
</module>
|
data/.idea/encodings.xml
ADDED
data/.idea/misc.xml
ADDED
data/.idea/modules.xml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/aws-dynamodb-query.iml" filepath="$PROJECT_DIR$/.idea/aws-dynamodb-query.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
data/.idea/workspace.xml
ADDED
@@ -0,0 +1,368 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ChangeListManager">
|
4
|
+
<list default="true" id="70ffc16e-1950-4181-b8c2-8ff3ff5a72ac" name="Default" comment="">
|
5
|
+
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.gitignore" />
|
6
|
+
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/aws-dynamodb-query.iml" />
|
7
|
+
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/encodings.xml" />
|
8
|
+
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/misc.xml" />
|
9
|
+
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/modules.xml" />
|
10
|
+
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
11
|
+
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.travis.yml" />
|
12
|
+
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/CODE_OF_CONDUCT.md" />
|
13
|
+
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/Gemfile" />
|
14
|
+
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/LICENSE.txt" />
|
15
|
+
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/README.md" />
|
16
|
+
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/Rakefile" />
|
17
|
+
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/aws-dynamodb-query.gemspec" />
|
18
|
+
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/bin/console" />
|
19
|
+
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/bin/setup" />
|
20
|
+
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/lib/aws/dynamodb/query.rb" />
|
21
|
+
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/lib/aws/dynamodb/query/version.rb" />
|
22
|
+
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/test/aws/dynamodb/query_test.rb" />
|
23
|
+
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/test/test_helper.rb" />
|
24
|
+
</list>
|
25
|
+
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
26
|
+
<option name="TRACKING_ENABLED" value="true" />
|
27
|
+
<option name="SHOW_DIALOG" value="false" />
|
28
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
29
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
30
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
31
|
+
</component>
|
32
|
+
<component name="FileEditorManager">
|
33
|
+
<leaf>
|
34
|
+
<file leaf-file-name="query_test.rb" pinned="false" current-in-tab="false">
|
35
|
+
<entry file="file://$PROJECT_DIR$/test/aws/dynamodb/query_test.rb">
|
36
|
+
<provider selected="true" editor-type-id="text-editor">
|
37
|
+
<state relative-caret-position="17">
|
38
|
+
<caret line="1" column="0" lean-forward="false" selection-start-line="1" selection-start-column="0" selection-end-line="1" selection-end-column="28" />
|
39
|
+
<folding />
|
40
|
+
</state>
|
41
|
+
</provider>
|
42
|
+
</entry>
|
43
|
+
</file>
|
44
|
+
<file leaf-file-name="query.rb" pinned="false" current-in-tab="false">
|
45
|
+
<entry file="file://$PROJECT_DIR$/lib/aws/dynamodb/query.rb">
|
46
|
+
<provider selected="true" editor-type-id="text-editor">
|
47
|
+
<state relative-caret-position="364">
|
48
|
+
<caret line="62" column="0" lean-forward="true" selection-start-line="62" selection-start-column="0" selection-end-line="62" selection-end-column="0" />
|
49
|
+
<folding />
|
50
|
+
</state>
|
51
|
+
</provider>
|
52
|
+
</entry>
|
53
|
+
</file>
|
54
|
+
<file leaf-file-name="v4.rb" pinned="false" current-in-tab="false">
|
55
|
+
<entry file="file://$USER_HOME$/.rvm/gems/ruby-2.3.0/gems/aws-signature-v4-0.1.0/lib/aws/signature/v4.rb">
|
56
|
+
<provider selected="true" editor-type-id="text-editor">
|
57
|
+
<state relative-caret-position="490">
|
58
|
+
<caret line="77" column="33" lean-forward="false" selection-start-line="77" selection-start-column="33" selection-end-line="77" selection-end-column="33" />
|
59
|
+
<folding />
|
60
|
+
</state>
|
61
|
+
</provider>
|
62
|
+
</entry>
|
63
|
+
</file>
|
64
|
+
<file leaf-file-name="version.rb" pinned="false" current-in-tab="false">
|
65
|
+
<entry file="file://$PROJECT_DIR$/lib/aws/dynamodb/query/version.rb">
|
66
|
+
<provider selected="true" editor-type-id="text-editor">
|
67
|
+
<state relative-caret-position="45">
|
68
|
+
<caret line="3" column="22" lean-forward="true" selection-start-line="3" selection-start-column="22" selection-end-line="3" selection-end-column="22" />
|
69
|
+
<folding />
|
70
|
+
</state>
|
71
|
+
</provider>
|
72
|
+
</entry>
|
73
|
+
</file>
|
74
|
+
<file leaf-file-name="README.md" pinned="false" current-in-tab="true">
|
75
|
+
<entry file="file://$PROJECT_DIR$/README.md">
|
76
|
+
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
77
|
+
<state split_layout="SPLIT">
|
78
|
+
<first_editor relative-caret-position="225">
|
79
|
+
<caret line="15" column="25" lean-forward="true" selection-start-line="15" selection-start-column="25" selection-end-line="15" selection-end-column="25" />
|
80
|
+
<folding />
|
81
|
+
</first_editor>
|
82
|
+
<second_editor />
|
83
|
+
</state>
|
84
|
+
</provider>
|
85
|
+
</entry>
|
86
|
+
</file>
|
87
|
+
<file leaf-file-name="aws-dynamodb-query.gemspec" pinned="false" current-in-tab="false">
|
88
|
+
<entry file="file://$PROJECT_DIR$/aws-dynamodb-query.gemspec">
|
89
|
+
<provider selected="true" editor-type-id="text-editor">
|
90
|
+
<state relative-caret-position="180">
|
91
|
+
<caret line="12" column="212" lean-forward="false" selection-start-line="12" selection-start-column="24" selection-end-line="12" selection-end-column="212" />
|
92
|
+
<folding />
|
93
|
+
</state>
|
94
|
+
</provider>
|
95
|
+
</entry>
|
96
|
+
</file>
|
97
|
+
</leaf>
|
98
|
+
</component>
|
99
|
+
<component name="FindInProjectRecents">
|
100
|
+
<findStrings>
|
101
|
+
<find>rubo</find>
|
102
|
+
<find>files</find>
|
103
|
+
<find>sig</find>
|
104
|
+
<find>ENV</find>
|
105
|
+
<find>last_evaluated_key</find>
|
106
|
+
<find>pagination</find>
|
107
|
+
<find>@secret_key</find>
|
108
|
+
<find>aws_access_key_id</find>
|
109
|
+
<find>Signature</find>
|
110
|
+
<find>Rails.logger</find>
|
111
|
+
<find>@record</find>
|
112
|
+
<find>result</find>
|
113
|
+
<find>:errors</find>
|
114
|
+
<find>res['errors']</find>
|
115
|
+
<find>res</find>
|
116
|
+
<find>res[:errors]</find>
|
117
|
+
<find>puts</find>
|
118
|
+
<find>``</find>
|
119
|
+
<find>e.g. 'http://dynamodb.ap-southeast-1.amazonaws.com'</find>
|
120
|
+
</findStrings>
|
121
|
+
</component>
|
122
|
+
<component name="Git.Settings">
|
123
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
124
|
+
</component>
|
125
|
+
<component name="IdeDocumentHistory">
|
126
|
+
<option name="CHANGED_PATHS">
|
127
|
+
<list>
|
128
|
+
<option value="$PROJECT_DIR$/aws-dynamodb-query.gemspec" />
|
129
|
+
<option value="$PROJECT_DIR$/test/test_helper.rb" />
|
130
|
+
<option value="$PROJECT_DIR$/lib/aws/dynamodb/query.rb" />
|
131
|
+
<option value="$PROJECT_DIR$/lib/aws/dynamodb/query/version.rb" />
|
132
|
+
<option value="$PROJECT_DIR$/Gemfile" />
|
133
|
+
<option value="$PROJECT_DIR$/test/aws/dynamodb/query_test.rb" />
|
134
|
+
<option value="$PROJECT_DIR$/README.md" />
|
135
|
+
</list>
|
136
|
+
</option>
|
137
|
+
</component>
|
138
|
+
<component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
|
139
|
+
<component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
|
140
|
+
<component name="JsGulpfileManager">
|
141
|
+
<detection-done>true</detection-done>
|
142
|
+
<sorting>DEFINITION_ORDER</sorting>
|
143
|
+
</component>
|
144
|
+
<component name="ProjectFrameBounds" fullScreen="true">
|
145
|
+
<option name="x" value="294" />
|
146
|
+
<option name="y" value="23" />
|
147
|
+
<option name="width" value="1535" />
|
148
|
+
<option name="height" value="1344" />
|
149
|
+
</component>
|
150
|
+
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
151
|
+
<component name="ProjectView">
|
152
|
+
<navigator currentView="ProjectPane" proportions="" version="1">
|
153
|
+
<flattenPackages />
|
154
|
+
<showMembers />
|
155
|
+
<showModules />
|
156
|
+
<showLibraryContents />
|
157
|
+
<hideEmptyPackages />
|
158
|
+
<abbreviatePackageNames />
|
159
|
+
<autoscrollToSource />
|
160
|
+
<autoscrollFromSource />
|
161
|
+
<sortByType />
|
162
|
+
<manualOrder />
|
163
|
+
<foldersAlwaysOnTop value="true" />
|
164
|
+
</navigator>
|
165
|
+
<panes>
|
166
|
+
<pane id="Scope" />
|
167
|
+
<pane id="Scratches" />
|
168
|
+
<pane id="ProjectPane">
|
169
|
+
<subPane>
|
170
|
+
<expand>
|
171
|
+
<path>
|
172
|
+
<item name="aws-dynamodb-query" type="b2602c69:ProjectViewProjectNode" />
|
173
|
+
<item name="aws-dynamodb-query" type="462c0819:PsiDirectoryNode" />
|
174
|
+
</path>
|
175
|
+
<path>
|
176
|
+
<item name="aws-dynamodb-query" type="b2602c69:ProjectViewProjectNode" />
|
177
|
+
<item name="aws-dynamodb-query" type="462c0819:PsiDirectoryNode" />
|
178
|
+
<item name="test" type="462c0819:PsiDirectoryNode" />
|
179
|
+
</path>
|
180
|
+
<path>
|
181
|
+
<item name="aws-dynamodb-query" type="b2602c69:ProjectViewProjectNode" />
|
182
|
+
<item name="aws-dynamodb-query" type="462c0819:PsiDirectoryNode" />
|
183
|
+
<item name="test" type="462c0819:PsiDirectoryNode" />
|
184
|
+
<item name="aws" type="462c0819:PsiDirectoryNode" />
|
185
|
+
</path>
|
186
|
+
<path>
|
187
|
+
<item name="aws-dynamodb-query" type="b2602c69:ProjectViewProjectNode" />
|
188
|
+
<item name="aws-dynamodb-query" type="462c0819:PsiDirectoryNode" />
|
189
|
+
<item name="test" type="462c0819:PsiDirectoryNode" />
|
190
|
+
<item name="aws" type="462c0819:PsiDirectoryNode" />
|
191
|
+
<item name="dynamodb" type="462c0819:PsiDirectoryNode" />
|
192
|
+
</path>
|
193
|
+
</expand>
|
194
|
+
<select />
|
195
|
+
</subPane>
|
196
|
+
</pane>
|
197
|
+
</panes>
|
198
|
+
</component>
|
199
|
+
<component name="PropertiesComponent">
|
200
|
+
<property name="WebServerToolWindowFactoryState" value="false" />
|
201
|
+
</component>
|
202
|
+
<component name="RecentsManager">
|
203
|
+
<key name="CopyFile.RECENT_KEYS">
|
204
|
+
<recent name="$PROJECT_DIR$/config/initializers" />
|
205
|
+
<recent name="$PROJECT_DIR$/db" />
|
206
|
+
</key>
|
207
|
+
</component>
|
208
|
+
<component name="RunDashboard">
|
209
|
+
<option name="ruleStates">
|
210
|
+
<list>
|
211
|
+
<RuleState>
|
212
|
+
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
213
|
+
</RuleState>
|
214
|
+
<RuleState>
|
215
|
+
<option name="name" value="StatusDashboardGroupingRule" />
|
216
|
+
</RuleState>
|
217
|
+
</list>
|
218
|
+
</option>
|
219
|
+
</component>
|
220
|
+
<component name="ShelveChangesManager" show_recycled="false">
|
221
|
+
<option name="remove_strategy" value="false" />
|
222
|
+
</component>
|
223
|
+
<component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" />
|
224
|
+
<component name="SvnConfiguration">
|
225
|
+
<configuration />
|
226
|
+
</component>
|
227
|
+
<component name="TaskManager">
|
228
|
+
<task active="true" id="Default" summary="Default task">
|
229
|
+
<changelist id="70ffc16e-1950-4181-b8c2-8ff3ff5a72ac" name="Default" comment="" />
|
230
|
+
<created>1509361321788</created>
|
231
|
+
<option name="number" value="Default" />
|
232
|
+
<option name="presentableId" value="Default" />
|
233
|
+
<updated>1509361321788</updated>
|
234
|
+
<workItem from="1509361323008" duration="12032000" />
|
235
|
+
</task>
|
236
|
+
<servers />
|
237
|
+
</component>
|
238
|
+
<component name="TimeTrackingManager">
|
239
|
+
<option name="totallyTimeSpent" value="12032000" />
|
240
|
+
</component>
|
241
|
+
<component name="ToolWindowManager">
|
242
|
+
<frame x="0" y="0" width="1548" height="1440" extended-state="0" />
|
243
|
+
<editor active="true" />
|
244
|
+
<layout>
|
245
|
+
<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" />
|
246
|
+
<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" />
|
247
|
+
<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.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
|
248
|
+
<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="-1" side_tool="false" content_ui="tabs" x="100" y="100" width="1476" height="1240" />
|
249
|
+
<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="-1" side_tool="false" content_ui="tabs" />
|
250
|
+
<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" />
|
251
|
+
<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" />
|
252
|
+
<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.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
253
|
+
<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" />
|
254
|
+
<window_info id="Terminal" 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" />
|
255
|
+
<window_info id="Debug" 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="3" side_tool="false" content_ui="tabs" />
|
256
|
+
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
|
257
|
+
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
258
|
+
<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" />
|
259
|
+
<window_info id="Message" 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="0" side_tool="false" content_ui="tabs" />
|
260
|
+
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
261
|
+
<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" />
|
262
|
+
<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" />
|
263
|
+
</layout>
|
264
|
+
</component>
|
265
|
+
<component name="TypeScriptGeneratedFilesManager">
|
266
|
+
<option name="version" value="1" />
|
267
|
+
</component>
|
268
|
+
<component name="VcsContentAnnotationSettings">
|
269
|
+
<option name="myLimit" value="2678400000" />
|
270
|
+
</component>
|
271
|
+
<component name="XDebuggerManager">
|
272
|
+
<breakpoint-manager />
|
273
|
+
<watches-manager />
|
274
|
+
</component>
|
275
|
+
<component name="editorHistoryManager">
|
276
|
+
<entry file="file://$USER_HOME$/.rvm/gems/ruby-2.3.0/gems/bundler-1.14.3/lib/bundler/dsl.rb">
|
277
|
+
<provider selected="true" editor-type-id="text-editor">
|
278
|
+
<state relative-caret-position="430">
|
279
|
+
<caret line="51" column="8" lean-forward="false" selection-start-line="51" selection-start-column="8" selection-end-line="51" selection-end-column="8" />
|
280
|
+
<folding />
|
281
|
+
</state>
|
282
|
+
</provider>
|
283
|
+
</entry>
|
284
|
+
<entry file="file://$PROJECT_DIR$/db/seeds.rb">
|
285
|
+
<provider selected="true" editor-type-id="text-editor">
|
286
|
+
<state relative-caret-position="180">
|
287
|
+
<caret line="12" column="52" lean-forward="true" selection-start-line="12" selection-start-column="52" selection-end-line="12" selection-end-column="52" />
|
288
|
+
<folding />
|
289
|
+
</state>
|
290
|
+
</provider>
|
291
|
+
</entry>
|
292
|
+
<entry file="file://$PROJECT_DIR$/config/initializers/db_custom.rb">
|
293
|
+
<provider selected="true" editor-type-id="text-editor">
|
294
|
+
<state relative-caret-position="165">
|
295
|
+
<caret line="11" column="25" lean-forward="true" selection-start-line="11" selection-start-column="25" selection-end-line="11" selection-end-column="25" />
|
296
|
+
<folding />
|
297
|
+
</state>
|
298
|
+
</provider>
|
299
|
+
</entry>
|
300
|
+
<entry file="file://$PROJECT_DIR$/test/test_helper.rb">
|
301
|
+
<provider selected="true" editor-type-id="text-editor">
|
302
|
+
<state relative-caret-position="45">
|
303
|
+
<caret line="3" column="26" lean-forward="true" selection-start-line="3" selection-start-column="26" selection-end-line="3" selection-end-column="26" />
|
304
|
+
<folding />
|
305
|
+
</state>
|
306
|
+
</provider>
|
307
|
+
</entry>
|
308
|
+
<entry file="file://$USER_HOME$/.rvm/gems/ruby-2.3.0/gems/aws-signature-v4-0.1.0/lib/aws/signature/v4.rb">
|
309
|
+
<provider selected="true" editor-type-id="text-editor">
|
310
|
+
<state relative-caret-position="490">
|
311
|
+
<caret line="77" column="33" lean-forward="false" selection-start-line="77" selection-start-column="33" selection-end-line="77" selection-end-column="33" />
|
312
|
+
<folding />
|
313
|
+
</state>
|
314
|
+
</provider>
|
315
|
+
</entry>
|
316
|
+
<entry file="file://$PROJECT_DIR$/lib/aws/dynamodb/query/version.rb">
|
317
|
+
<provider selected="true" editor-type-id="text-editor">
|
318
|
+
<state relative-caret-position="45">
|
319
|
+
<caret line="3" column="22" lean-forward="true" selection-start-line="3" selection-start-column="22" selection-end-line="3" selection-end-column="22" />
|
320
|
+
<folding />
|
321
|
+
</state>
|
322
|
+
</provider>
|
323
|
+
</entry>
|
324
|
+
<entry file="file://$PROJECT_DIR$/Gemfile">
|
325
|
+
<provider selected="true" editor-type-id="text-editor">
|
326
|
+
<state relative-caret-position="90">
|
327
|
+
<caret line="6" column="0" lean-forward="false" selection-start-line="6" selection-start-column="0" selection-end-line="6" selection-end-column="0" />
|
328
|
+
<folding />
|
329
|
+
</state>
|
330
|
+
</provider>
|
331
|
+
</entry>
|
332
|
+
<entry file="file://$PROJECT_DIR$/aws-dynamodb-query.gemspec">
|
333
|
+
<provider selected="true" editor-type-id="text-editor">
|
334
|
+
<state relative-caret-position="180">
|
335
|
+
<caret line="12" column="212" lean-forward="false" selection-start-line="12" selection-start-column="24" selection-end-line="12" selection-end-column="212" />
|
336
|
+
<folding />
|
337
|
+
</state>
|
338
|
+
</provider>
|
339
|
+
</entry>
|
340
|
+
<entry file="file://$PROJECT_DIR$/lib/aws/dynamodb/query.rb">
|
341
|
+
<provider selected="true" editor-type-id="text-editor">
|
342
|
+
<state relative-caret-position="364">
|
343
|
+
<caret line="62" column="0" lean-forward="true" selection-start-line="62" selection-start-column="0" selection-end-line="62" selection-end-column="0" />
|
344
|
+
<folding />
|
345
|
+
</state>
|
346
|
+
</provider>
|
347
|
+
</entry>
|
348
|
+
<entry file="file://$PROJECT_DIR$/test/aws/dynamodb/query_test.rb">
|
349
|
+
<provider selected="true" editor-type-id="text-editor">
|
350
|
+
<state relative-caret-position="17">
|
351
|
+
<caret line="1" column="0" lean-forward="false" selection-start-line="1" selection-start-column="0" selection-end-line="1" selection-end-column="28" />
|
352
|
+
<folding />
|
353
|
+
</state>
|
354
|
+
</provider>
|
355
|
+
</entry>
|
356
|
+
<entry file="file://$PROJECT_DIR$/README.md">
|
357
|
+
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
358
|
+
<state split_layout="SPLIT">
|
359
|
+
<first_editor relative-caret-position="225">
|
360
|
+
<caret line="15" column="25" lean-forward="true" selection-start-line="15" selection-start-column="25" selection-end-line="15" selection-end-column="25" />
|
361
|
+
<folding />
|
362
|
+
</first_editor>
|
363
|
+
<second_editor />
|
364
|
+
</state>
|
365
|
+
</provider>
|
366
|
+
</entry>
|
367
|
+
</component>
|
368
|
+
</project>
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at khaled@supahands.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 khaled83
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Aws::Dynamodb::Query
|
2
|
+
|
3
|
+
Executes low level API DynamoDB Query (http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html#DDB-Query-request-KeyConditionExpression) with less memory footprint.
|
4
|
+
|
5
|
+
The following query options are currently supported:
|
6
|
+
1. index_name
|
7
|
+
2. select
|
8
|
+
3. key_condition_expression
|
9
|
+
4. expression_attribute_names
|
10
|
+
5. expression_attribute_values
|
11
|
+
6. scan_index_forward
|
12
|
+
7. return_consumed_capacity
|
13
|
+
8. aws_access_key_id
|
14
|
+
9. aws_secret_access_key
|
15
|
+
10. aws_region
|
16
|
+
11. aws_dynamodb_endpoint
|
17
|
+
|
18
|
+
Support for more Query options will be added in future releases.
|
19
|
+
|
20
|
+
## Installation
|
21
|
+
|
22
|
+
Add this line to your application's Gemfile:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
gem 'aws-dynamodb-query'
|
26
|
+
```
|
27
|
+
|
28
|
+
And then execute:
|
29
|
+
|
30
|
+
$ bundle
|
31
|
+
|
32
|
+
Or install it yourself as:
|
33
|
+
|
34
|
+
$ gem install aws-dynamodb-query
|
35
|
+
|
36
|
+
## Usage
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
require 'aws/dynamodb/query'
|
40
|
+
|
41
|
+
aws_access_key_id = 'AKIAJVB3LAMUASP5JTUQ'
|
42
|
+
aws_secret_access_key = 'cD4kSv9XDZgFhb2Bps/63h4+oMPudnpRt4GDS9Rr'
|
43
|
+
aws_region = 'ap-southeast-1'
|
44
|
+
aws_dynamodb_endpoint = 'http://dynamodb.ap-southeast-1.amazonaws.com'
|
45
|
+
|
46
|
+
res = Query.call('my_table',
|
47
|
+
index_name: 'role-created_at-index',
|
48
|
+
select: 'ALL_ATTRIBUTES',
|
49
|
+
key_condition_expression: '#profile_role = :profile_role',
|
50
|
+
expression_attribute_names: { '#profile_role' => 'role' },
|
51
|
+
expression_attribute_values: { ':profile_role' => { 'S' => 'ADMIN' } },
|
52
|
+
scan_index_forward: true,
|
53
|
+
return_consumed_capacity: 'TOTAL',
|
54
|
+
aws_access_key_id: aws_access_key_id,
|
55
|
+
aws_secret_access_key: aws_secret_access_key,
|
56
|
+
aws_region: aws_region,
|
57
|
+
aws_dynamodb_endpoint: aws_dynamodb_endpoint)
|
58
|
+
```
|
59
|
+
|
60
|
+
## Development
|
61
|
+
|
62
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
63
|
+
|
64
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
65
|
+
|
66
|
+
## Contributing
|
67
|
+
|
68
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/khaled83/aws-dynamodb-query. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
69
|
+
|
70
|
+
|
71
|
+
## License
|
72
|
+
|
73
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
74
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'aws/dynamodb/query/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'aws-dynamodb-query'
|
8
|
+
spec.version = Aws::Dynamodb::Query::VERSION
|
9
|
+
spec.authors = ['khaled83']
|
10
|
+
spec.email = ['khaled@supahands.com']
|
11
|
+
|
12
|
+
spec.summary = 'Executes low level API DynamoDB Query.'
|
13
|
+
spec.description = 'Executes low level API DynamoDB Query (http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html#DDB-Query-request-KeyConditionExpression) with minimal memory footprint.'
|
14
|
+
spec.homepage = 'https://github.com/Supahands/aws-dynamodb-query.git'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
21
|
+
else
|
22
|
+
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
23
|
+
'public gem pushes.'
|
24
|
+
end
|
25
|
+
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
28
|
+
end
|
29
|
+
spec.bindir = 'exe'
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ['lib']
|
32
|
+
|
33
|
+
spec.add_development_dependency 'bundler', '~> 1.14'
|
34
|
+
spec.add_development_dependency 'minitest', '~> 5.0'
|
35
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
36
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "aws/dynamodb/query"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
require 'aws/dynamodb/query/version'
|
2
|
+
require 'aws/signature/v4'
|
3
|
+
|
4
|
+
module Aws
|
5
|
+
module Dynamodb
|
6
|
+
module Query
|
7
|
+
class Query
|
8
|
+
# Your code goes here...
|
9
|
+
|
10
|
+
# Queries Dynamodb for items.
|
11
|
+
# @see http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html
|
12
|
+
#
|
13
|
+
# @param [String] table_name The name of the table containing the requested items.
|
14
|
+
# @param [String] index_name The name of an index to query
|
15
|
+
# @param [String] select The attributes to be returned in the result: ALL_ATTRIBUTES, ALL_PROJECTED_ATTRIBUTES, COUNT, SPECIFIC_ATTRIBUTES
|
16
|
+
# @param [String] key_condition_expression The condition that specifies the key value(s) for items to be retrieved by the Query action
|
17
|
+
# @param [Hash] expression_attribute_names One or more substitution tokens for attribute names in an expression
|
18
|
+
# @param [Hash] expression_attribute_values One or more values that can be substituted in an expression
|
19
|
+
# @param [String] scan_index_forward Specifies the order for index traversal: If true (default), the traversal is performed in ascending order; if false, the traversal is performed in descending order
|
20
|
+
# @param [String] return_consumed_capacity Determines the level of detail about provisioned throughput consumption that is returned in the response: INDEXES, TOTAL, NONE
|
21
|
+
# @param [Boolean] pagination true by default. This will get maximum 1MB of data. To retrieve all your table data which could exceed 1MB, set pagination to false.
|
22
|
+
# @param [String] last_evaluated_key if pagination is true, this will point to the next page of data to retrieve
|
23
|
+
# @param [String] aws_region AWS region is obtained by default from ENV['AWS_REGION'], use this parameter to override with your own
|
24
|
+
# @param [String] aws_access_key_id AWS access key id is obtained by default from ENV['AWS_ACCESS_KEY_ID'], use this parameter to override with your own
|
25
|
+
# @param [String] aws_secret_access_key AWS secret access key is obtained by default from ENV['AWS_SECRET_ACCESS_KEY'], use this parameter to override with your own
|
26
|
+
# @param [String] aws_dynamodb_endpoint AWS dynamodb endpoint is obtained by default from ENV['aws_dynamodb_endpoint'], use this parameter to override with your own
|
27
|
+
#
|
28
|
+
# @return [Array] array of Ruby Hash objects where each object contains all the values returned from dynamodb in dasherized format
|
29
|
+
def self.call(table_name, index_name: nil, select: nil, key_condition_expression: nil, expression_attribute_names: nil, expression_attribute_values: nil, scan_index_forward: true, return_consumed_capacity: nil, pagination: false, last_evaluated_key: nil, aws_region: ENV['AWS_REGION'], aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'], aws_secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'], aws_dynamodb_endpoint: ENV['aws_dynamodb_endpoint'])
|
30
|
+
result = []
|
31
|
+
# DyanmoDB Query results are divided into "pages" of data that are 1 MB in size (or less).
|
32
|
+
# Agents data exceeds 1MB so we need multiple pages.
|
33
|
+
# @see http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.html#Query.Pagination
|
34
|
+
last_evaluated_key = last_evaluated_key
|
35
|
+
loop do
|
36
|
+
payload = {
|
37
|
+
TableName: table_name
|
38
|
+
}
|
39
|
+
# optional query parameters
|
40
|
+
payload[:IndexName] = index_name if index_name
|
41
|
+
payload[:select] = select if select
|
42
|
+
payload[:KeyConditionExpression] = key_condition_expression if key_condition_expression
|
43
|
+
payload[:ExpressionAttributeNames] = expression_attribute_names if expression_attribute_names
|
44
|
+
payload[:ExpressionAttributeValues] = expression_attribute_values if expression_attribute_values
|
45
|
+
payload[:scan_index_forward] = scan_index_forward if scan_index_forward
|
46
|
+
payload[:ReturnConsumedCapacity] = return_consumed_capacity if return_consumed_capacity
|
47
|
+
payload[:ExclusiveStartKey] = last_evaluated_key if last_evaluated_key
|
48
|
+
|
49
|
+
# generate AWS Authorization header
|
50
|
+
aws_signature = Aws::Signature::V4::Signature.new(aws_region, aws_access_key_id, aws_secret_access_key)
|
51
|
+
aws_signature.generate_signature('dynamodb', 'DynamoDB_20120810.Query', 'POST', payload, aws_dynamodb_endpoint, '/')
|
52
|
+
# Create the HTTP objects
|
53
|
+
uri = URI.parse(aws_dynamodb_endpoint)
|
54
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
55
|
+
http.use_ssl = aws_dynamodb_endpoint.include?('https')
|
56
|
+
request = Net::HTTP::Post.new(uri.request_uri, aws_signature.headers)
|
57
|
+
request.body = payload.to_json
|
58
|
+
res = http.request(request)
|
59
|
+
|
60
|
+
# error => return empty array
|
61
|
+
unless res.is_a? Net::HTTPSuccess
|
62
|
+
Rails.logger.error "Error querying DynamoDB: code=#{res.code} message=#{res.message} body=#{res.body}" if defined? Rails
|
63
|
+
|
64
|
+
# jsonapi error format
|
65
|
+
result = {
|
66
|
+
errors: [
|
67
|
+
status: res.code,
|
68
|
+
title: res.message,
|
69
|
+
detail: res.body
|
70
|
+
]
|
71
|
+
}
|
72
|
+
return result
|
73
|
+
end
|
74
|
+
|
75
|
+
puts '*** SUCCESS querying database'
|
76
|
+
# success => parse returned json
|
77
|
+
json = Yajl::Parser.new.parse(res.body)
|
78
|
+
|
79
|
+
# extract and construct resultset array
|
80
|
+
json['Items'].each do |item|
|
81
|
+
record = {}
|
82
|
+
stored_attributes = []
|
83
|
+
item.keys.each do |key|
|
84
|
+
# @see: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_AttributeValue.html
|
85
|
+
# Sample dynamodb item: {"date_joined"=>{"S"=>"2017-09-30T16:00:00+00:00"}, "contact_country_code"=>{"NULL"=>true}, "full_name"=>{"S"=>"Breena"}, "has_bank_swift"=>{"BOOL"=>false}}
|
86
|
+
dynamodb_data_types = %w[S BOOL BS L M N NS NULL S SS]
|
87
|
+
# value could be found in one of these data types
|
88
|
+
key_dasherized = key.to_s.dasherize
|
89
|
+
dynamodb_data_types.each do |data_type|
|
90
|
+
record[key_dasherized] = record[key_dasherized] || item[key][data_type]
|
91
|
+
end
|
92
|
+
stored_attributes += [key.to_sym]
|
93
|
+
end
|
94
|
+
|
95
|
+
# nullify remaining model attributes to be included in returned result
|
96
|
+
unset_attributes = Agent.attribute_keys - stored_attributes
|
97
|
+
unset_attributes.each do |attr|
|
98
|
+
record[attr.to_s.dasherize] = nil
|
99
|
+
end
|
100
|
+
|
101
|
+
result << record
|
102
|
+
end
|
103
|
+
|
104
|
+
# LastEvaluatedKey in the response indicates that not all of the items have been retrieved.
|
105
|
+
# It should be used as the ExclusiveStartKey for the next Query request to retrieve the next page items.
|
106
|
+
last_evaluated_key = json['LastEvaluatedKey']
|
107
|
+
# Break if pagination is enabled. Else, absence of LastEvaluatedKey indicates that there are no more pages to retrieve.
|
108
|
+
break if pagination.present? || last_evaluated_key.blank?
|
109
|
+
end
|
110
|
+
result
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: aws-dynamodb-query
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- khaled83
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-11-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.14'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.14'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description: Executes low level API DynamoDB Query (http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html#DDB-Query-request-KeyConditionExpression)
|
56
|
+
with minimal memory footprint.
|
57
|
+
email:
|
58
|
+
- khaled@supahands.com
|
59
|
+
executables: []
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- ".idea/aws-dynamodb-query.iml"
|
65
|
+
- ".idea/encodings.xml"
|
66
|
+
- ".idea/misc.xml"
|
67
|
+
- ".idea/modules.xml"
|
68
|
+
- ".idea/workspace.xml"
|
69
|
+
- ".travis.yml"
|
70
|
+
- CODE_OF_CONDUCT.md
|
71
|
+
- Gemfile
|
72
|
+
- LICENSE.txt
|
73
|
+
- README.md
|
74
|
+
- Rakefile
|
75
|
+
- aws-dynamodb-query.gemspec
|
76
|
+
- bin/console
|
77
|
+
- bin/setup
|
78
|
+
- lib/aws/dynamodb/query.rb
|
79
|
+
- lib/aws/dynamodb/query/version.rb
|
80
|
+
homepage: https://github.com/Supahands/aws-dynamodb-query.git
|
81
|
+
licenses:
|
82
|
+
- MIT
|
83
|
+
metadata:
|
84
|
+
allowed_push_host: https://rubygems.org
|
85
|
+
post_install_message:
|
86
|
+
rdoc_options: []
|
87
|
+
require_paths:
|
88
|
+
- lib
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
requirements: []
|
100
|
+
rubyforge_project:
|
101
|
+
rubygems_version: 2.5.1
|
102
|
+
signing_key:
|
103
|
+
specification_version: 4
|
104
|
+
summary: Executes low level API DynamoDB Query.
|
105
|
+
test_files: []
|