dynamoid 0.6.1 → 0.7.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.
- data/.travis.yml +4 -0
- data/Gemfile +3 -2
- data/Gemfile.lock +40 -45
- data/README.markdown +55 -25
- data/Rakefile +31 -0
- data/VERSION +1 -1
- data/doc/Dynamoid.html +58 -42
- data/doc/Dynamoid/Adapter.html +666 -179
- data/doc/Dynamoid/Adapter/AwsSdk.html +752 -236
- data/doc/Dynamoid/Associations.html +28 -21
- data/doc/Dynamoid/Associations/Association.html +102 -49
- data/doc/Dynamoid/Associations/BelongsTo.html +28 -25
- data/doc/Dynamoid/Associations/ClassMethods.html +95 -52
- data/doc/Dynamoid/Associations/HasAndBelongsToMany.html +28 -25
- data/doc/Dynamoid/Associations/HasMany.html +28 -25
- data/doc/Dynamoid/Associations/HasOne.html +28 -25
- data/doc/Dynamoid/Associations/ManyAssociation.html +138 -94
- data/doc/Dynamoid/Associations/SingleAssociation.html +67 -38
- data/doc/Dynamoid/Components.html +60 -22
- data/doc/Dynamoid/Config.html +61 -44
- data/doc/Dynamoid/Config/Options.html +90 -61
- data/doc/Dynamoid/Criteria.html +28 -21
- data/doc/Dynamoid/Criteria/Chain.html +508 -100
- data/doc/Dynamoid/Criteria/ClassMethods.html +26 -19
- data/doc/Dynamoid/Dirty.html +424 -0
- data/doc/Dynamoid/Dirty/ClassMethods.html +174 -0
- data/doc/Dynamoid/Document.html +451 -84
- data/doc/Dynamoid/Document/ClassMethods.html +281 -102
- data/doc/Dynamoid/Errors.html +29 -22
- data/doc/Dynamoid/Errors/ConditionalCheckFailedException.html +141 -0
- data/doc/Dynamoid/Errors/DocumentNotValid.html +36 -25
- data/doc/Dynamoid/Errors/Error.html +27 -20
- data/doc/Dynamoid/Errors/InvalidField.html +27 -19
- data/doc/Dynamoid/Errors/InvalidQuery.html +131 -0
- data/doc/Dynamoid/Errors/MissingRangeKey.html +27 -19
- data/doc/Dynamoid/Fields.html +94 -77
- data/doc/Dynamoid/Fields/ClassMethods.html +166 -37
- data/doc/Dynamoid/Finders.html +28 -21
- data/doc/Dynamoid/Finders/ClassMethods.html +505 -78
- data/doc/Dynamoid/IdentityMap.html +492 -0
- data/doc/Dynamoid/IdentityMap/ClassMethods.html +534 -0
- data/doc/Dynamoid/Indexes.html +41 -28
- data/doc/Dynamoid/Indexes/ClassMethods.html +45 -29
- data/doc/Dynamoid/Indexes/Index.html +100 -62
- data/doc/Dynamoid/Middleware.html +115 -0
- data/doc/Dynamoid/Middleware/IdentityMap.html +264 -0
- data/doc/Dynamoid/Persistence.html +326 -85
- data/doc/Dynamoid/Persistence/ClassMethods.html +275 -109
- data/doc/Dynamoid/Validations.html +47 -31
- data/doc/_index.html +116 -71
- data/doc/class_list.html +13 -7
- data/doc/css/full_list.css +4 -2
- data/doc/css/style.css +60 -44
- data/doc/file.LICENSE.html +26 -19
- data/doc/file.README.html +152 -48
- data/doc/file_list.html +14 -8
- data/doc/frames.html +20 -5
- data/doc/index.html +152 -48
- data/doc/js/app.js +52 -43
- data/doc/js/full_list.js +14 -9
- data/doc/js/jquery.js +4 -16
- data/doc/method_list.html +446 -540
- data/doc/top-level-namespace.html +27 -20
- data/{Dynamoid.gemspec → dynamoid.gemspec} +21 -8
- data/lib/dynamoid/adapter.rb +11 -10
- data/lib/dynamoid/adapter/aws_sdk.rb +40 -19
- data/lib/dynamoid/components.rb +2 -1
- data/lib/dynamoid/criteria/chain.rb +29 -11
- data/lib/dynamoid/dirty.rb +6 -0
- data/lib/dynamoid/document.rb +34 -19
- data/lib/dynamoid/fields.rb +36 -30
- data/lib/dynamoid/finders.rb +7 -5
- data/lib/dynamoid/persistence.rb +37 -10
- data/spec/app/models/address.rb +2 -0
- data/spec/app/models/camel_case.rb +10 -0
- data/spec/app/models/car.rb +6 -0
- data/spec/app/models/nuclear_submarine.rb +5 -0
- data/spec/app/models/subscription.rb +2 -2
- data/spec/app/models/vehicle.rb +7 -0
- data/spec/dynamoid/adapter/aws_sdk_spec.rb +20 -11
- data/spec/dynamoid/adapter_spec.rb +67 -82
- data/spec/dynamoid/associations/association_spec.rb +30 -30
- data/spec/dynamoid/criteria/chain_spec.rb +56 -9
- data/spec/dynamoid/criteria_spec.rb +3 -0
- data/spec/dynamoid/dirty_spec.rb +8 -0
- data/spec/dynamoid/document_spec.rb +109 -47
- data/spec/dynamoid/fields_spec.rb +32 -3
- data/spec/dynamoid/finders_spec.rb +12 -0
- data/spec/dynamoid/persistence_spec.rb +73 -8
- data/spec/spec_helper.rb +1 -0
- data/spec/support/with_partitioning.rb +15 -0
- metadata +22 -9
data/doc/Dynamoid/Criteria.html
CHANGED
|
@@ -6,19 +6,21 @@
|
|
|
6
6
|
<title>
|
|
7
7
|
Module: Dynamoid::Criteria
|
|
8
8
|
|
|
9
|
-
— Documentation by YARD 0.
|
|
9
|
+
— Documentation by YARD 0.8.6.1
|
|
10
10
|
|
|
11
11
|
</title>
|
|
12
12
|
|
|
13
|
-
<link rel="stylesheet" href="../css/style.css" type="text/css"
|
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
|
14
14
|
|
|
15
|
-
<link rel="stylesheet" href="../css/common.css" type="text/css"
|
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
|
16
16
|
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
|
19
|
+
relpath = '../';
|
|
20
|
+
framesUrl = "../frames.html#!" + escape(window.location.href);
|
|
20
21
|
</script>
|
|
21
22
|
|
|
23
|
+
|
|
22
24
|
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
|
23
25
|
|
|
24
26
|
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
|
@@ -26,36 +28,41 @@
|
|
|
26
28
|
|
|
27
29
|
</head>
|
|
28
30
|
<body>
|
|
29
|
-
<script type="text/javascript" charset="utf-8">
|
|
30
|
-
if (window.top.frames.main) document.body.className = 'frames';
|
|
31
|
-
</script>
|
|
32
|
-
|
|
33
31
|
<div id="header">
|
|
34
32
|
<div id="menu">
|
|
35
33
|
|
|
36
|
-
<a href="../_index.html">Index (C)</a> »
|
|
34
|
+
<a href="../_index.html">Index (C)</a> »
|
|
37
35
|
<span class='title'><span class='object_link'><a href="../Dynamoid.html" title="Dynamoid (module)">Dynamoid</a></span></span>
|
|
38
36
|
»
|
|
39
37
|
<span class="title">Criteria</span>
|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
|
|
42
40
|
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
|
43
41
|
</div>
|
|
44
42
|
|
|
45
43
|
<div id="search">
|
|
46
44
|
|
|
47
|
-
<a
|
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
|
46
|
+
href="../class_list.html">
|
|
47
|
+
Class List
|
|
48
|
+
</a>
|
|
48
49
|
|
|
49
|
-
<a
|
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
|
51
|
+
href="../method_list.html">
|
|
52
|
+
Method List
|
|
53
|
+
</a>
|
|
50
54
|
|
|
51
|
-
<a
|
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
|
56
|
+
href="../file_list.html">
|
|
57
|
+
File List
|
|
58
|
+
</a>
|
|
52
59
|
|
|
53
60
|
</div>
|
|
54
61
|
<div class="clear"></div>
|
|
55
62
|
</div>
|
|
56
|
-
|
|
63
|
+
|
|
57
64
|
<iframe id="search_frame"></iframe>
|
|
58
|
-
|
|
65
|
+
|
|
59
66
|
<div id="content"><h1>Module: Dynamoid::Criteria
|
|
60
67
|
|
|
61
68
|
|
|
@@ -99,11 +106,11 @@
|
|
|
99
106
|
|
|
100
107
|
</div><h2>Defined Under Namespace</h2>
|
|
101
108
|
<p class="children">
|
|
102
|
-
|
|
109
|
+
|
|
103
110
|
|
|
104
111
|
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Criteria/ClassMethods.html" title="Dynamoid::Criteria::ClassMethods (module)">ClassMethods</a></span>
|
|
105
112
|
|
|
106
|
-
|
|
113
|
+
|
|
107
114
|
|
|
108
115
|
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Criteria/Chain.html" title="Dynamoid::Criteria::Chain (class)">Chain</a></span>
|
|
109
116
|
|
|
@@ -120,11 +127,11 @@
|
|
|
120
127
|
|
|
121
128
|
|
|
122
129
|
</div>
|
|
123
|
-
|
|
130
|
+
|
|
124
131
|
<div id="footer">
|
|
125
|
-
Generated on Thu
|
|
132
|
+
Generated on Thu Jun 27 21:59:12 2013 by
|
|
126
133
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
127
|
-
0.
|
|
134
|
+
0.8.6.1 (ruby-1.9.3).
|
|
128
135
|
</div>
|
|
129
136
|
|
|
130
137
|
</body>
|
|
@@ -6,19 +6,21 @@
|
|
|
6
6
|
<title>
|
|
7
7
|
Class: Dynamoid::Criteria::Chain
|
|
8
8
|
|
|
9
|
-
— Documentation by YARD 0.
|
|
9
|
+
— Documentation by YARD 0.8.6.1
|
|
10
10
|
|
|
11
11
|
</title>
|
|
12
12
|
|
|
13
|
-
<link rel="stylesheet" href="../../css/style.css" type="text/css"
|
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
|
|
14
14
|
|
|
15
|
-
<link rel="stylesheet" href="../../css/common.css" type="text/css"
|
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
|
|
16
16
|
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
|
19
|
+
relpath = '../../';
|
|
20
|
+
framesUrl = "../../frames.html#!" + escape(window.location.href);
|
|
20
21
|
</script>
|
|
21
22
|
|
|
23
|
+
|
|
22
24
|
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
|
23
25
|
|
|
24
26
|
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
|
@@ -26,36 +28,41 @@
|
|
|
26
28
|
|
|
27
29
|
</head>
|
|
28
30
|
<body>
|
|
29
|
-
<script type="text/javascript" charset="utf-8">
|
|
30
|
-
if (window.top.frames.main) document.body.className = 'frames';
|
|
31
|
-
</script>
|
|
32
|
-
|
|
33
31
|
<div id="header">
|
|
34
32
|
<div id="menu">
|
|
35
33
|
|
|
36
|
-
<a href="../../_index.html">Index (C)</a> »
|
|
34
|
+
<a href="../../_index.html">Index (C)</a> »
|
|
37
35
|
<span class='title'><span class='object_link'><a href="../../Dynamoid.html" title="Dynamoid (module)">Dynamoid</a></span></span> » <span class='title'><span class='object_link'><a href="../Criteria.html" title="Dynamoid::Criteria (module)">Criteria</a></span></span>
|
|
38
36
|
»
|
|
39
37
|
<span class="title">Chain</span>
|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
|
|
42
40
|
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
|
43
41
|
</div>
|
|
44
42
|
|
|
45
43
|
<div id="search">
|
|
46
44
|
|
|
47
|
-
<a
|
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
|
46
|
+
href="../../class_list.html">
|
|
47
|
+
Class List
|
|
48
|
+
</a>
|
|
48
49
|
|
|
49
|
-
<a
|
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
|
51
|
+
href="../../method_list.html">
|
|
52
|
+
Method List
|
|
53
|
+
</a>
|
|
50
54
|
|
|
51
|
-
<a
|
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
|
56
|
+
href="../../file_list.html">
|
|
57
|
+
File List
|
|
58
|
+
</a>
|
|
52
59
|
|
|
53
60
|
</div>
|
|
54
61
|
<div class="clear"></div>
|
|
55
62
|
</div>
|
|
56
|
-
|
|
63
|
+
|
|
57
64
|
<iframe id="search_frame"></iframe>
|
|
58
|
-
|
|
65
|
+
|
|
59
66
|
<div id="content"><h1>Class: Dynamoid::Criteria::Chain
|
|
60
67
|
|
|
61
68
|
|
|
@@ -125,6 +132,7 @@ or by a full table scan.</p>
|
|
|
125
132
|
</span>
|
|
126
133
|
|
|
127
134
|
|
|
135
|
+
|
|
128
136
|
|
|
129
137
|
|
|
130
138
|
|
|
@@ -137,6 +145,34 @@ or by a full table scan.</p>
|
|
|
137
145
|
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute consistent_read.</p>
|
|
138
146
|
</div></span>
|
|
139
147
|
|
|
148
|
+
</li>
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
<li class="public ">
|
|
152
|
+
<span class="summary_signature">
|
|
153
|
+
|
|
154
|
+
<a href="#index%3D-instance_method" title="#index= (instance method)">- (Object) <strong>index</strong> </a>
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
</span>
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
<span class="note title writeonly">writeonly</span>
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
<span class="summary_desc"><div class='inline'><p>Sets the attribute index.</p>
|
|
174
|
+
</div></span>
|
|
175
|
+
|
|
140
176
|
</li>
|
|
141
177
|
|
|
142
178
|
|
|
@@ -150,6 +186,7 @@ or by a full table scan.</p>
|
|
|
150
186
|
</span>
|
|
151
187
|
|
|
152
188
|
|
|
189
|
+
|
|
153
190
|
|
|
154
191
|
|
|
155
192
|
|
|
@@ -175,6 +212,7 @@ or by a full table scan.</p>
|
|
|
175
212
|
</span>
|
|
176
213
|
|
|
177
214
|
|
|
215
|
+
|
|
178
216
|
|
|
179
217
|
|
|
180
218
|
|
|
@@ -200,6 +238,7 @@ or by a full table scan.</p>
|
|
|
200
238
|
</span>
|
|
201
239
|
|
|
202
240
|
|
|
241
|
+
|
|
203
242
|
|
|
204
243
|
|
|
205
244
|
|
|
@@ -225,6 +264,7 @@ or by a full table scan.</p>
|
|
|
225
264
|
</span>
|
|
226
265
|
|
|
227
266
|
|
|
267
|
+
|
|
228
268
|
|
|
229
269
|
|
|
230
270
|
|
|
@@ -250,6 +290,7 @@ or by a full table scan.</p>
|
|
|
250
290
|
</span>
|
|
251
291
|
|
|
252
292
|
|
|
293
|
+
|
|
253
294
|
|
|
254
295
|
|
|
255
296
|
|
|
@@ -281,7 +322,7 @@ or by a full table scan.</p>
|
|
|
281
322
|
<li class="public ">
|
|
282
323
|
<span class="summary_signature">
|
|
283
324
|
|
|
284
|
-
<a href="#all-instance_method" title="#all (instance method)">- (Object) <strong>all</strong> </a>
|
|
325
|
+
<a href="#all-instance_method" title="#all (instance method)">- (Object) <strong>all</strong>(opts = {}) </a>
|
|
285
326
|
|
|
286
327
|
|
|
287
328
|
|
|
@@ -292,11 +333,34 @@ or by a full table scan.</p>
|
|
|
292
333
|
|
|
293
334
|
|
|
294
335
|
|
|
336
|
+
|
|
295
337
|
|
|
296
338
|
|
|
297
339
|
<span class="summary_desc"><div class='inline'><p>Returns all the records matching the criteria.</p>
|
|
298
340
|
</div></span>
|
|
299
341
|
|
|
342
|
+
</li>
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
<li class="public ">
|
|
346
|
+
<span class="summary_signature">
|
|
347
|
+
|
|
348
|
+
<a href="#batch-instance_method" title="#batch (instance method)">- (Object) <strong>batch</strong>(batch_size) </a>
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
</span>
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
363
|
+
|
|
300
364
|
</li>
|
|
301
365
|
|
|
302
366
|
|
|
@@ -314,6 +378,7 @@ or by a full table scan.</p>
|
|
|
314
378
|
|
|
315
379
|
|
|
316
380
|
|
|
381
|
+
|
|
317
382
|
|
|
318
383
|
|
|
319
384
|
<span class="summary_desc"><div class='inline'></div></span>
|
|
@@ -335,10 +400,34 @@ or by a full table scan.</p>
|
|
|
335
400
|
|
|
336
401
|
|
|
337
402
|
|
|
403
|
+
|
|
338
404
|
|
|
339
405
|
|
|
340
406
|
<span class="summary_desc"><div class='inline'></div></span>
|
|
341
407
|
|
|
408
|
+
</li>
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
<li class="public ">
|
|
412
|
+
<span class="summary_signature">
|
|
413
|
+
|
|
414
|
+
<a href="#destroy_all-instance_method" title="#destroy_all (instance method)">- (Object) <strong>destroy_all</strong> </a>
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
</span>
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
<span class="summary_desc"><div class='inline'><p>Destroys all the records matching the criteria.</p>
|
|
429
|
+
</div></span>
|
|
430
|
+
|
|
342
431
|
</li>
|
|
343
432
|
|
|
344
433
|
|
|
@@ -356,6 +445,7 @@ or by a full table scan.</p>
|
|
|
356
445
|
|
|
357
446
|
|
|
358
447
|
|
|
448
|
+
|
|
359
449
|
|
|
360
450
|
|
|
361
451
|
<span class="summary_desc"><div class='inline'><p>Allows you to use the results of a search as an enumerable over the results found.</p>
|
|
@@ -378,6 +468,7 @@ or by a full table scan.</p>
|
|
|
378
468
|
|
|
379
469
|
|
|
380
470
|
|
|
471
|
+
|
|
381
472
|
|
|
382
473
|
|
|
383
474
|
<span class="summary_desc"><div class='inline'><p>Returns the first record matching the criteria.</p>
|
|
@@ -395,6 +486,7 @@ or by a full table scan.</p>
|
|
|
395
486
|
|
|
396
487
|
</span>
|
|
397
488
|
|
|
489
|
+
|
|
398
490
|
<span class="note title constructor">constructor</span>
|
|
399
491
|
|
|
400
492
|
|
|
@@ -407,6 +499,28 @@ or by a full table scan.</p>
|
|
|
407
499
|
<span class="summary_desc"><div class='inline'><p>Create a new criteria chain.</p>
|
|
408
500
|
</div></span>
|
|
409
501
|
|
|
502
|
+
</li>
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
<li class="public ">
|
|
506
|
+
<span class="summary_signature">
|
|
507
|
+
|
|
508
|
+
<a href="#scan_index_forward-instance_method" title="#scan_index_forward (instance method)">- (Object) <strong>scan_index_forward</strong>(scan_index_forward) </a>
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
</span>
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
523
|
+
|
|
410
524
|
</li>
|
|
411
525
|
|
|
412
526
|
|
|
@@ -424,6 +538,7 @@ or by a full table scan.</p>
|
|
|
424
538
|
|
|
425
539
|
|
|
426
540
|
|
|
541
|
+
|
|
427
542
|
|
|
428
543
|
|
|
429
544
|
<span class="summary_desc"><div class='inline'><p>The workhorse method of the criteria chain.</p>
|
|
@@ -440,13 +555,15 @@ or by a full table scan.</p>
|
|
|
440
555
|
<h2>Constructor Details</h2>
|
|
441
556
|
|
|
442
557
|
<div class="method_details first">
|
|
443
|
-
<
|
|
558
|
+
<h3 class="signature first" id="initialize-instance_method">
|
|
444
559
|
|
|
445
560
|
- (<tt><span class='object_link'><a href="" title="Dynamoid::Criteria::Chain (class)">Chain</a></span></tt>) <strong>initialize</strong>(source)
|
|
446
561
|
|
|
447
562
|
|
|
448
563
|
|
|
449
|
-
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
</h3><div class="docstring">
|
|
450
567
|
<div class="discussion">
|
|
451
568
|
<p>Create a new criteria chain.</p>
|
|
452
569
|
|
|
@@ -454,7 +571,7 @@ or by a full table scan.</p>
|
|
|
454
571
|
</div>
|
|
455
572
|
</div>
|
|
456
573
|
<div class="tags">
|
|
457
|
-
<
|
|
574
|
+
<p class="tag_title">Parameters:</p>
|
|
458
575
|
<ul class="param">
|
|
459
576
|
|
|
460
577
|
<li>
|
|
@@ -485,7 +602,8 @@ or by a full table scan.</p>
|
|
|
485
602
|
16
|
|
486
603
|
17
|
|
487
604
|
18
|
|
488
|
-
19
|
|
605
|
+
19
|
|
606
|
+
20</pre>
|
|
489
607
|
</td>
|
|
490
608
|
<td>
|
|
491
609
|
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line 15</span>
|
|
@@ -494,6 +612,7 @@ or by a full table scan.</p>
|
|
|
494
612
|
<span class='ivar'>@query</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
|
495
613
|
<span class='ivar'>@source</span> <span class='op'>=</span> <span class='id identifier rubyid_source'>source</span>
|
|
496
614
|
<span class='ivar'>@consistent_read</span> <span class='op'>=</span> <span class='kw'>false</span>
|
|
615
|
+
<span class='ivar'>@scan_index_forward</span> <span class='op'>=</span> <span class='kw'>true</span>
|
|
497
616
|
<span class='kw'>end</span></pre>
|
|
498
617
|
</td>
|
|
499
618
|
</tr>
|
|
@@ -507,15 +626,16 @@ or by a full table scan.</p>
|
|
|
507
626
|
|
|
508
627
|
|
|
509
628
|
<span id="consistent_read=-instance_method"></span>
|
|
510
|
-
<span id="consistent_read-instance_method"></span>
|
|
511
629
|
<div class="method_details first">
|
|
512
|
-
<
|
|
630
|
+
<h3 class="signature first" id="consistent_read-instance_method">
|
|
513
631
|
|
|
514
632
|
- (<tt>Object</tt>) <strong>consistent_read</strong>
|
|
515
633
|
|
|
516
634
|
|
|
517
635
|
|
|
518
|
-
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
</h3><div class="docstring">
|
|
519
639
|
<div class="discussion">
|
|
520
640
|
<p>Returns the value of attribute consistent_read</p>
|
|
521
641
|
|
|
@@ -547,16 +667,78 @@ or by a full table scan.</p>
|
|
|
547
667
|
</div>
|
|
548
668
|
|
|
549
669
|
|
|
670
|
+
<span id="index-instance_method"></span>
|
|
671
|
+
<div class="method_details ">
|
|
672
|
+
<h3 class="signature " id="index=-instance_method">
|
|
673
|
+
|
|
674
|
+
- (<tt>Object</tt>) <strong>index=</strong>(value)
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
</h3><div class="docstring">
|
|
681
|
+
<div class="discussion">
|
|
682
|
+
<p>Sets the attribute index</p>
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
</div>
|
|
686
|
+
</div>
|
|
687
|
+
<div class="tags">
|
|
688
|
+
<p class="tag_title">Parameters:</p>
|
|
689
|
+
<ul class="param">
|
|
690
|
+
|
|
691
|
+
<li>
|
|
692
|
+
|
|
693
|
+
<span class='name'>value</span>
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
<span class='type'></span>
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
|
|
700
|
+
—
|
|
701
|
+
<div class='inline'><p>the value to set the attribute index to.</p>
|
|
702
|
+
</div>
|
|
703
|
+
|
|
704
|
+
</li>
|
|
705
|
+
|
|
706
|
+
</ul>
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
</div><table class="source_code">
|
|
710
|
+
<tr>
|
|
711
|
+
<td>
|
|
712
|
+
<pre class="lines">
|
|
713
|
+
|
|
714
|
+
|
|
715
|
+
9
|
|
716
|
+
10
|
|
717
|
+
11</pre>
|
|
718
|
+
</td>
|
|
719
|
+
<td>
|
|
720
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line 9</span>
|
|
721
|
+
|
|
722
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_index='>index=</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
|
723
|
+
<span class='ivar'>@index</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
|
|
724
|
+
<span class='kw'>end</span></pre>
|
|
725
|
+
</td>
|
|
726
|
+
</tr>
|
|
727
|
+
</table>
|
|
728
|
+
</div>
|
|
729
|
+
|
|
730
|
+
|
|
550
731
|
<span id="limit=-instance_method"></span>
|
|
551
|
-
<span id="limit-instance_method"></span>
|
|
552
732
|
<div class="method_details ">
|
|
553
|
-
<
|
|
733
|
+
<h3 class="signature " id="limit-instance_method">
|
|
554
734
|
|
|
555
735
|
- (<tt>Object</tt>) <strong>limit</strong>(limit)
|
|
556
736
|
|
|
557
737
|
|
|
558
738
|
|
|
559
|
-
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
</h3><div class="docstring">
|
|
560
742
|
<div class="discussion">
|
|
561
743
|
<p>Returns the value of attribute limit</p>
|
|
562
744
|
|
|
@@ -574,15 +756,13 @@ or by a full table scan.</p>
|
|
|
574
756
|
|
|
575
757
|
9
|
|
576
758
|
10
|
|
577
|
-
11
|
|
578
|
-
12</pre>
|
|
759
|
+
11</pre>
|
|
579
760
|
</td>
|
|
580
761
|
<td>
|
|
581
762
|
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line 9</span>
|
|
582
763
|
|
|
583
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_limit'>limit</span
|
|
584
|
-
<span class='ivar'>@limit</span>
|
|
585
|
-
<span class='id identifier rubyid_records'>records</span>
|
|
764
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_limit'>limit</span>
|
|
765
|
+
<span class='ivar'>@limit</span>
|
|
586
766
|
<span class='kw'>end</span></pre>
|
|
587
767
|
</td>
|
|
588
768
|
</tr>
|
|
@@ -591,15 +771,16 @@ or by a full table scan.</p>
|
|
|
591
771
|
|
|
592
772
|
|
|
593
773
|
<span id="query=-instance_method"></span>
|
|
594
|
-
<span id="query-instance_method"></span>
|
|
595
774
|
<div class="method_details ">
|
|
596
|
-
<
|
|
775
|
+
<h3 class="signature " id="query-instance_method">
|
|
597
776
|
|
|
598
777
|
- (<tt>Object</tt>) <strong>query</strong>
|
|
599
778
|
|
|
600
779
|
|
|
601
780
|
|
|
602
|
-
|
|
781
|
+
|
|
782
|
+
|
|
783
|
+
</h3><div class="docstring">
|
|
603
784
|
<div class="discussion">
|
|
604
785
|
<p>Returns the value of attribute query</p>
|
|
605
786
|
|
|
@@ -632,15 +813,16 @@ or by a full table scan.</p>
|
|
|
632
813
|
|
|
633
814
|
|
|
634
815
|
<span id="source=-instance_method"></span>
|
|
635
|
-
<span id="source-instance_method"></span>
|
|
636
816
|
<div class="method_details ">
|
|
637
|
-
<
|
|
817
|
+
<h3 class="signature " id="source-instance_method">
|
|
638
818
|
|
|
639
819
|
- (<tt>Object</tt>) <strong>source</strong>
|
|
640
820
|
|
|
641
821
|
|
|
642
822
|
|
|
643
|
-
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
</h3><div class="docstring">
|
|
644
826
|
<div class="discussion">
|
|
645
827
|
<p>Returns the value of attribute source</p>
|
|
646
828
|
|
|
@@ -673,15 +855,16 @@ or by a full table scan.</p>
|
|
|
673
855
|
|
|
674
856
|
|
|
675
857
|
<span id="start=-instance_method"></span>
|
|
676
|
-
<span id="start-instance_method"></span>
|
|
677
858
|
<div class="method_details ">
|
|
678
|
-
<
|
|
859
|
+
<h3 class="signature " id="start-instance_method">
|
|
679
860
|
|
|
680
861
|
- (<tt>Object</tt>) <strong>start</strong>(start)
|
|
681
862
|
|
|
682
863
|
|
|
683
864
|
|
|
684
|
-
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
</h3><div class="docstring">
|
|
685
868
|
<div class="discussion">
|
|
686
869
|
<p>Returns the value of attribute start</p>
|
|
687
870
|
|
|
@@ -699,15 +882,13 @@ or by a full table scan.</p>
|
|
|
699
882
|
|
|
700
883
|
9
|
|
701
884
|
10
|
|
702
|
-
11
|
|
703
|
-
12</pre>
|
|
885
|
+
11</pre>
|
|
704
886
|
</td>
|
|
705
887
|
<td>
|
|
706
888
|
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line 9</span>
|
|
707
889
|
|
|
708
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_start'>start</span
|
|
709
|
-
<span class='ivar'>@start</span>
|
|
710
|
-
<span class='kw'>self</span>
|
|
890
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_start'>start</span>
|
|
891
|
+
<span class='ivar'>@start</span>
|
|
711
892
|
<span class='kw'>end</span></pre>
|
|
712
893
|
</td>
|
|
713
894
|
</tr>
|
|
@@ -716,15 +897,16 @@ or by a full table scan.</p>
|
|
|
716
897
|
|
|
717
898
|
|
|
718
899
|
<span id="values=-instance_method"></span>
|
|
719
|
-
<span id="values-instance_method"></span>
|
|
720
900
|
<div class="method_details ">
|
|
721
|
-
<
|
|
901
|
+
<h3 class="signature " id="values-instance_method">
|
|
722
902
|
|
|
723
903
|
- (<tt>Object</tt>) <strong>values</strong>
|
|
724
904
|
|
|
725
905
|
|
|
726
906
|
|
|
727
|
-
|
|
907
|
+
|
|
908
|
+
|
|
909
|
+
</h3><div class="docstring">
|
|
728
910
|
<div class="discussion">
|
|
729
911
|
<p>Returns the value of attribute values</p>
|
|
730
912
|
|
|
@@ -760,16 +942,18 @@ or by a full table scan.</p>
|
|
|
760
942
|
|
|
761
943
|
<div id="instance_method_details" class="method_details_list">
|
|
762
944
|
<h2>Instance Method Details</h2>
|
|
763
|
-
|
|
945
|
+
|
|
764
946
|
|
|
765
947
|
<div class="method_details first">
|
|
766
|
-
<
|
|
948
|
+
<h3 class="signature first" id="all-instance_method">
|
|
949
|
+
|
|
950
|
+
- (<tt>Object</tt>) <strong>all</strong>(opts = {})
|
|
767
951
|
|
|
768
|
-
|
|
952
|
+
|
|
769
953
|
|
|
770
954
|
|
|
771
955
|
|
|
772
|
-
</
|
|
956
|
+
</h3><div class="docstring">
|
|
773
957
|
<div class="discussion">
|
|
774
958
|
<p>Returns all the records matching the criteria.</p>
|
|
775
959
|
|
|
@@ -778,7 +962,7 @@ or by a full table scan.</p>
|
|
|
778
962
|
</div>
|
|
779
963
|
<div class="tags">
|
|
780
964
|
|
|
781
|
-
<
|
|
965
|
+
<p class="tag_title">Since:</p>
|
|
782
966
|
<ul class="since">
|
|
783
967
|
|
|
784
968
|
<li>
|
|
@@ -800,14 +984,16 @@ or by a full table scan.</p>
|
|
|
800
984
|
<pre class="lines">
|
|
801
985
|
|
|
802
986
|
|
|
803
|
-
45
|
|
804
987
|
46
|
|
805
|
-
47
|
|
988
|
+
47
|
|
989
|
+
48
|
|
990
|
+
49</pre>
|
|
806
991
|
</td>
|
|
807
992
|
<td>
|
|
808
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line
|
|
993
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line 46</span>
|
|
809
994
|
|
|
810
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_all'>all</span>
|
|
995
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_all'>all</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
|
996
|
+
<span class='id identifier rubyid_batch'>batch</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:batch_size</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span> <span class='symbol'>:batch_size</span>
|
|
811
997
|
<span class='id identifier rubyid_records'>records</span>
|
|
812
998
|
<span class='kw'>end</span></pre>
|
|
813
999
|
</td>
|
|
@@ -816,25 +1002,61 @@ or by a full table scan.</p>
|
|
|
816
1002
|
</div>
|
|
817
1003
|
|
|
818
1004
|
<div class="method_details ">
|
|
819
|
-
<
|
|
1005
|
+
<h3 class="signature " id="batch-instance_method">
|
|
1006
|
+
|
|
1007
|
+
- (<tt>Object</tt>) <strong>batch</strong>(batch_size)
|
|
1008
|
+
|
|
1009
|
+
|
|
1010
|
+
|
|
1011
|
+
|
|
1012
|
+
|
|
1013
|
+
</h3><table class="source_code">
|
|
1014
|
+
<tr>
|
|
1015
|
+
<td>
|
|
1016
|
+
<pre class="lines">
|
|
1017
|
+
|
|
1018
|
+
|
|
1019
|
+
120
|
|
1020
|
+
121
|
|
1021
|
+
122
|
|
1022
|
+
123
|
|
1023
|
+
124</pre>
|
|
1024
|
+
</td>
|
|
1025
|
+
<td>
|
|
1026
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line 120</span>
|
|
1027
|
+
|
|
1028
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_batch'>batch</span><span class='lparen'>(</span><span class='id identifier rubyid_batch_size'>batch_size</span><span class='rparen'>)</span>
|
|
1029
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Cannot batch calls when using partitioning</span><span class='tstring_end'>'</span></span> <span class='kw'>if</span> <span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Config</span><span class='period'>.</span><span class='id identifier rubyid_partitioning?'>partitioning?</span>
|
|
1030
|
+
<span class='ivar'>@batch_size</span> <span class='op'>=</span> <span class='id identifier rubyid_batch_size'>batch_size</span>
|
|
1031
|
+
<span class='kw'>self</span>
|
|
1032
|
+
<span class='kw'>end</span></pre>
|
|
1033
|
+
</td>
|
|
1034
|
+
</tr>
|
|
1035
|
+
</table>
|
|
1036
|
+
</div>
|
|
1037
|
+
|
|
1038
|
+
<div class="method_details ">
|
|
1039
|
+
<h3 class="signature " id="consistent-instance_method">
|
|
820
1040
|
|
|
821
1041
|
- (<tt>Object</tt>) <strong>consistent</strong>
|
|
822
1042
|
|
|
823
1043
|
|
|
824
1044
|
|
|
825
|
-
|
|
1045
|
+
|
|
1046
|
+
|
|
1047
|
+
</h3><table class="source_code">
|
|
826
1048
|
<tr>
|
|
827
1049
|
<td>
|
|
828
1050
|
<pre class="lines">
|
|
829
1051
|
|
|
830
1052
|
|
|
831
|
-
37
|
|
832
1053
|
38
|
|
833
1054
|
39
|
|
834
|
-
40
|
|
1055
|
+
40
|
|
1056
|
+
41</pre>
|
|
835
1057
|
</td>
|
|
836
1058
|
<td>
|
|
837
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line
|
|
1059
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line 38</span>
|
|
838
1060
|
|
|
839
1061
|
<span class='kw'>def</span> <span class='id identifier rubyid_consistent'>consistent</span>
|
|
840
1062
|
<span class='ivar'>@consistent_read</span> <span class='op'>=</span> <span class='kw'>true</span>
|
|
@@ -846,24 +1068,26 @@ or by a full table scan.</p>
|
|
|
846
1068
|
</div>
|
|
847
1069
|
|
|
848
1070
|
<div class="method_details ">
|
|
849
|
-
<
|
|
1071
|
+
<h3 class="signature " id="consistent_opts-instance_method">
|
|
850
1072
|
|
|
851
1073
|
- (<tt>Object</tt>) <strong>consistent_opts</strong>
|
|
852
1074
|
|
|
853
1075
|
|
|
854
1076
|
|
|
855
|
-
|
|
1077
|
+
|
|
1078
|
+
|
|
1079
|
+
</h3><table class="source_code">
|
|
856
1080
|
<tr>
|
|
857
1081
|
<td>
|
|
858
1082
|
<pre class="lines">
|
|
859
1083
|
|
|
860
1084
|
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
1085
|
+
143
|
|
1086
|
+
144
|
|
1087
|
+
145</pre>
|
|
864
1088
|
</td>
|
|
865
1089
|
<td>
|
|
866
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line
|
|
1090
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line 143</span>
|
|
867
1091
|
|
|
868
1092
|
<span class='kw'>def</span> <span class='id identifier rubyid_consistent_opts'>consistent_opts</span>
|
|
869
1093
|
<span class='lbrace'>{</span> <span class='symbol'>:consistent_read</span> <span class='op'>=></span> <span class='id identifier rubyid_consistent_read'>consistent_read</span> <span class='rbrace'>}</span>
|
|
@@ -874,13 +1098,157 @@ or by a full table scan.</p>
|
|
|
874
1098
|
</div>
|
|
875
1099
|
|
|
876
1100
|
<div class="method_details ">
|
|
877
|
-
<
|
|
1101
|
+
<h3 class="signature " id="destroy_all-instance_method">
|
|
1102
|
+
|
|
1103
|
+
- (<tt>Object</tt>) <strong>destroy_all</strong>
|
|
1104
|
+
|
|
1105
|
+
|
|
1106
|
+
|
|
1107
|
+
|
|
1108
|
+
|
|
1109
|
+
</h3><div class="docstring">
|
|
1110
|
+
<div class="discussion">
|
|
1111
|
+
<p>Destroys all the records matching the criteria.</p>
|
|
1112
|
+
|
|
1113
|
+
|
|
1114
|
+
</div>
|
|
1115
|
+
</div>
|
|
1116
|
+
<div class="tags">
|
|
1117
|
+
|
|
1118
|
+
|
|
1119
|
+
</div><table class="source_code">
|
|
1120
|
+
<tr>
|
|
1121
|
+
<td>
|
|
1122
|
+
<pre class="lines">
|
|
1123
|
+
|
|
1124
|
+
|
|
1125
|
+
53
|
|
1126
|
+
54
|
|
1127
|
+
55
|
|
1128
|
+
56
|
|
1129
|
+
57
|
|
1130
|
+
58
|
|
1131
|
+
59
|
|
1132
|
+
60
|
|
1133
|
+
61
|
|
1134
|
+
62
|
|
1135
|
+
63
|
|
1136
|
+
64
|
|
1137
|
+
65
|
|
1138
|
+
66
|
|
1139
|
+
67
|
|
1140
|
+
68
|
|
1141
|
+
69
|
|
1142
|
+
70
|
|
1143
|
+
71
|
|
1144
|
+
72
|
|
1145
|
+
73
|
|
1146
|
+
74
|
|
1147
|
+
75
|
|
1148
|
+
76
|
|
1149
|
+
77
|
|
1150
|
+
78
|
|
1151
|
+
79
|
|
1152
|
+
80
|
|
1153
|
+
81
|
|
1154
|
+
82
|
|
1155
|
+
83
|
|
1156
|
+
84
|
|
1157
|
+
85
|
|
1158
|
+
86
|
|
1159
|
+
87
|
|
1160
|
+
88
|
|
1161
|
+
89
|
|
1162
|
+
90
|
|
1163
|
+
91
|
|
1164
|
+
92
|
|
1165
|
+
93
|
|
1166
|
+
94
|
|
1167
|
+
95
|
|
1168
|
+
96
|
|
1169
|
+
97
|
|
1170
|
+
98
|
|
1171
|
+
99
|
|
1172
|
+
100
|
|
1173
|
+
101
|
|
1174
|
+
102
|
|
1175
|
+
103
|
|
1176
|
+
104
|
|
1177
|
+
105
|
|
1178
|
+
106</pre>
|
|
1179
|
+
</td>
|
|
1180
|
+
<td>
|
|
1181
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line 53</span>
|
|
1182
|
+
|
|
1183
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_destroy_all'>destroy_all</span>
|
|
1184
|
+
<span class='id identifier rubyid_ids'>ids</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
|
1185
|
+
|
|
1186
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_range?'>range?</span>
|
|
1187
|
+
<span class='id identifier rubyid_ranges'>ranges</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
|
1188
|
+
<span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Adapter</span><span class='period'>.</span><span class='id identifier rubyid_query'>query</span><span class='lparen'>(</span><span class='id identifier rubyid_source'>source</span><span class='period'>.</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_range_query'>range_query</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_hash'>hash</span><span class='op'>|</span>
|
|
1189
|
+
<span class='id identifier rubyid_ids'>ids</span> <span class='op'><<</span> <span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_source'>source</span><span class='period'>.</span><span class='id identifier rubyid_hash_key'>hash_key</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span>
|
|
1190
|
+
<span class='id identifier rubyid_ranges'>ranges</span> <span class='op'><<</span> <span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_source'>source</span><span class='period'>.</span><span class='id identifier rubyid_range_key'>range_key</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span>
|
|
1191
|
+
<span class='kw'>end</span>
|
|
1192
|
+
|
|
1193
|
+
<span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Adapter</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_source'>source</span><span class='period'>.</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_ids'>ids</span><span class='comma'>,</span><span class='lbrace'>{</span><span class='symbol'>:range_key</span> <span class='op'>=></span> <span class='id identifier rubyid_ranges'>ranges</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
|
1194
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_index'>index</span>
|
|
1195
|
+
<span class='comment'>#TODO: test this throughly and find a way to delete all index table records for one source record
|
|
1196
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_index'>index</span><span class='period'>.</span><span class='id identifier rubyid_range_key?'>range_key?</span>
|
|
1197
|
+
<span class='id identifier rubyid_results'>results</span> <span class='op'>=</span> <span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Adapter</span><span class='period'>.</span><span class='id identifier rubyid_query'>query</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='period'>.</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_index_query'>index_query</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_consistent_opts'>consistent_opts</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
|
1198
|
+
<span class='kw'>else</span>
|
|
1199
|
+
<span class='id identifier rubyid_results'>results</span> <span class='op'>=</span> <span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Adapter</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='period'>.</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_index_query'>index_query</span><span class='lbracket'>[</span><span class='symbol'>:hash_value</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_consistent_opts'>consistent_opts</span><span class='rparen'>)</span>
|
|
1200
|
+
<span class='kw'>end</span>
|
|
1201
|
+
|
|
1202
|
+
<span class='id identifier rubyid_results'>results</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_hash'>hash</span><span class='op'>|</span>
|
|
1203
|
+
<span class='id identifier rubyid_ids'>ids</span> <span class='op'><<</span> <span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_source'>source</span><span class='period'>.</span><span class='id identifier rubyid_hash_key'>hash_key</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span>
|
|
1204
|
+
<span class='id identifier rubyid_index_ranges'>index_ranges</span> <span class='op'><<</span> <span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_source'>source</span><span class='period'>.</span><span class='id identifier rubyid_range_key'>range_key</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span>
|
|
1205
|
+
<span class='kw'>end</span>
|
|
1206
|
+
|
|
1207
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_ids'>ids</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_ids'>ids</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
|
1208
|
+
<span class='id identifier rubyid_ids'>ids</span> <span class='op'>=</span> <span class='id identifier rubyid_ids'>ids</span><span class='period'>.</span><span class='id identifier rubyid_to_a'>to_a</span>
|
|
1209
|
+
|
|
1210
|
+
<span class='kw'>if</span> <span class='ivar'>@start</span>
|
|
1211
|
+
<span class='id identifier rubyid_ids'>ids</span> <span class='op'>=</span> <span class='id identifier rubyid_ids'>ids</span><span class='period'>.</span><span class='id identifier rubyid_drop_while'>drop_while</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_id'>id</span><span class='op'>|</span> <span class='id identifier rubyid_id'>id</span> <span class='op'>!=</span> <span class='ivar'>@start</span><span class='period'>.</span><span class='id identifier rubyid_hash_key'>hash_key</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_drop'>drop</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
|
|
1212
|
+
<span class='id identifier rubyid_index_ranges'>index_ranges</span> <span class='op'>=</span> <span class='id identifier rubyid_index_ranges'>index_ranges</span><span class='period'>.</span><span class='id identifier rubyid_drop_while'>drop_while</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_range'>range</span><span class='op'>|</span> <span class='id identifier rubyid_range'>range</span> <span class='op'>!=</span> <span class='ivar'>@start</span><span class='period'>.</span><span class='id identifier rubyid_hash_key'>hash_key</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_drop'>drop</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_index_ranges'>index_ranges</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
|
1213
|
+
<span class='kw'>end</span>
|
|
1214
|
+
|
|
1215
|
+
<span class='kw'>if</span> <span class='ivar'>@limit</span>
|
|
1216
|
+
<span class='id identifier rubyid_ids'>ids</span> <span class='op'>=</span> <span class='id identifier rubyid_ids'>ids</span><span class='period'>.</span><span class='id identifier rubyid_take'>take</span><span class='lparen'>(</span><span class='ivar'>@limit</span><span class='rparen'>)</span>
|
|
1217
|
+
<span class='id identifier rubyid_index_ranges'>index_ranges</span> <span class='op'>=</span> <span class='id identifier rubyid_index_ranges'>index_ranges</span><span class='period'>.</span><span class='id identifier rubyid_take'>take</span><span class='lparen'>(</span><span class='ivar'>@limit</span><span class='rparen'>)</span>
|
|
1218
|
+
<span class='kw'>end</span>
|
|
1219
|
+
|
|
1220
|
+
<span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Adapter</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_source'>source</span><span class='period'>.</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_ids'>ids</span><span class='rparen'>)</span>
|
|
1221
|
+
|
|
1222
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_index'>index</span><span class='period'>.</span><span class='id identifier rubyid_range_key?'>range_key?</span>
|
|
1223
|
+
<span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Adapter</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='period'>.</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_ids'>ids</span><span class='comma'>,</span><span class='lbrace'>{</span><span class='symbol'>:range_key</span> <span class='op'>=></span> <span class='id identifier rubyid_index_ranges'>index_ranges</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
|
1224
|
+
<span class='kw'>else</span>
|
|
1225
|
+
<span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Adapter</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='period'>.</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_ids'>ids</span><span class='rparen'>)</span>
|
|
1226
|
+
<span class='kw'>end</span>
|
|
1227
|
+
|
|
1228
|
+
<span class='kw'>end</span>
|
|
1229
|
+
<span class='kw'>else</span>
|
|
1230
|
+
<span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Adapter</span><span class='period'>.</span><span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='id identifier rubyid_source'>source</span><span class='period'>.</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_query'>query</span><span class='comma'>,</span> <span class='id identifier rubyid_scan_opts'>scan_opts</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_hash'>hash</span><span class='op'>|</span>
|
|
1231
|
+
<span class='id identifier rubyid_ids'>ids</span> <span class='op'><<</span> <span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_source'>source</span><span class='period'>.</span><span class='id identifier rubyid_hash_key'>hash_key</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span>
|
|
1232
|
+
<span class='kw'>end</span>
|
|
1233
|
+
|
|
1234
|
+
<span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Adapter</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_source'>source</span><span class='period'>.</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_ids'>ids</span><span class='rparen'>)</span>
|
|
1235
|
+
<span class='kw'>end</span>
|
|
1236
|
+
<span class='kw'>end</span></pre>
|
|
1237
|
+
</td>
|
|
1238
|
+
</tr>
|
|
1239
|
+
</table>
|
|
1240
|
+
</div>
|
|
1241
|
+
|
|
1242
|
+
<div class="method_details ">
|
|
1243
|
+
<h3 class="signature " id="each-instance_method">
|
|
878
1244
|
|
|
879
1245
|
- (<tt>Object</tt>) <strong>each</strong>(&block)
|
|
880
1246
|
|
|
881
1247
|
|
|
882
1248
|
|
|
883
|
-
|
|
1249
|
+
|
|
1250
|
+
|
|
1251
|
+
</h3><div class="docstring">
|
|
884
1252
|
<div class="discussion">
|
|
885
1253
|
<p>Allows you to use the results of a search as an enumerable over the results found.</p>
|
|
886
1254
|
|
|
@@ -889,7 +1257,7 @@ or by a full table scan.</p>
|
|
|
889
1257
|
</div>
|
|
890
1258
|
<div class="tags">
|
|
891
1259
|
|
|
892
|
-
<
|
|
1260
|
+
<p class="tag_title">Since:</p>
|
|
893
1261
|
<ul class="since">
|
|
894
1262
|
|
|
895
1263
|
<li>
|
|
@@ -911,12 +1279,12 @@ or by a full table scan.</p>
|
|
|
911
1279
|
<pre class="lines">
|
|
912
1280
|
|
|
913
1281
|
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
1282
|
+
139
|
|
1283
|
+
140
|
|
1284
|
+
141</pre>
|
|
917
1285
|
</td>
|
|
918
1286
|
<td>
|
|
919
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line
|
|
1287
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line 139</span>
|
|
920
1288
|
|
|
921
1289
|
<span class='kw'>def</span> <span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
|
922
1290
|
<span class='id identifier rubyid_records'>records</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
|
@@ -927,13 +1295,15 @@ or by a full table scan.</p>
|
|
|
927
1295
|
</div>
|
|
928
1296
|
|
|
929
1297
|
<div class="method_details ">
|
|
930
|
-
<
|
|
1298
|
+
<h3 class="signature " id="first-instance_method">
|
|
931
1299
|
|
|
932
1300
|
- (<tt>Object</tt>) <strong>first</strong>
|
|
933
1301
|
|
|
934
1302
|
|
|
935
1303
|
|
|
936
|
-
|
|
1304
|
+
|
|
1305
|
+
|
|
1306
|
+
</h3><div class="docstring">
|
|
937
1307
|
<div class="discussion">
|
|
938
1308
|
<p>Returns the first record matching the criteria.</p>
|
|
939
1309
|
|
|
@@ -942,7 +1312,7 @@ or by a full table scan.</p>
|
|
|
942
1312
|
</div>
|
|
943
1313
|
<div class="tags">
|
|
944
1314
|
|
|
945
|
-
<
|
|
1315
|
+
<p class="tag_title">Since:</p>
|
|
946
1316
|
<ul class="since">
|
|
947
1317
|
|
|
948
1318
|
<li>
|
|
@@ -964,12 +1334,12 @@ or by a full table scan.</p>
|
|
|
964
1334
|
<pre class="lines">
|
|
965
1335
|
|
|
966
1336
|
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
1337
|
+
111
|
|
1338
|
+
112
|
|
1339
|
+
113</pre>
|
|
970
1340
|
</td>
|
|
971
1341
|
<td>
|
|
972
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line
|
|
1342
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line 111</span>
|
|
973
1343
|
|
|
974
1344
|
<span class='kw'>def</span> <span class='id identifier rubyid_first'>first</span>
|
|
975
1345
|
<span class='id identifier rubyid_limit'>limit</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
|
@@ -980,13 +1350,47 @@ or by a full table scan.</p>
|
|
|
980
1350
|
</div>
|
|
981
1351
|
|
|
982
1352
|
<div class="method_details ">
|
|
983
|
-
<
|
|
1353
|
+
<h3 class="signature " id="scan_index_forward-instance_method">
|
|
1354
|
+
|
|
1355
|
+
- (<tt>Object</tt>) <strong>scan_index_forward</strong>(scan_index_forward)
|
|
1356
|
+
|
|
1357
|
+
|
|
1358
|
+
|
|
1359
|
+
|
|
1360
|
+
|
|
1361
|
+
</h3><table class="source_code">
|
|
1362
|
+
<tr>
|
|
1363
|
+
<td>
|
|
1364
|
+
<pre class="lines">
|
|
1365
|
+
|
|
1366
|
+
|
|
1367
|
+
131
|
|
1368
|
+
132
|
|
1369
|
+
133
|
|
1370
|
+
134</pre>
|
|
1371
|
+
</td>
|
|
1372
|
+
<td>
|
|
1373
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line 131</span>
|
|
1374
|
+
|
|
1375
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_scan_index_forward'>scan_index_forward</span><span class='lparen'>(</span><span class='id identifier rubyid_scan_index_forward'>scan_index_forward</span><span class='rparen'>)</span>
|
|
1376
|
+
<span class='ivar'>@scan_index_forward</span> <span class='op'>=</span> <span class='id identifier rubyid_scan_index_forward'>scan_index_forward</span>
|
|
1377
|
+
<span class='kw'>self</span>
|
|
1378
|
+
<span class='kw'>end</span></pre>
|
|
1379
|
+
</td>
|
|
1380
|
+
</tr>
|
|
1381
|
+
</table>
|
|
1382
|
+
</div>
|
|
1383
|
+
|
|
1384
|
+
<div class="method_details ">
|
|
1385
|
+
<h3 class="signature " id="where-instance_method">
|
|
984
1386
|
|
|
985
1387
|
- (<tt>Object</tt>) <strong>where</strong>(args)
|
|
986
1388
|
|
|
987
1389
|
|
|
988
1390
|
|
|
989
|
-
|
|
1391
|
+
|
|
1392
|
+
|
|
1393
|
+
</h3><div class="docstring">
|
|
990
1394
|
<div class="discussion">
|
|
991
1395
|
<p>The workhorse method of the criteria chain. Each key in the passed in hash will become another criteria that the
|
|
992
1396
|
ultimate query must match. A key can either be a symbol or a string, and should be an attribute name or
|
|
@@ -998,19 +1402,23 @@ an attribute name with a range operator.</p>
|
|
|
998
1402
|
<div class="tags">
|
|
999
1403
|
|
|
1000
1404
|
<div class="examples">
|
|
1001
|
-
<
|
|
1405
|
+
<p class="tag_title">Examples:</p>
|
|
1002
1406
|
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1407
|
+
|
|
1408
|
+
<p class="example_title"><div class='inline'><p>A simple criteria</p>
|
|
1409
|
+
</div></p>
|
|
1410
|
+
|
|
1411
|
+
<pre class="example code"><code><span class='id identifier rubyid_where'>where</span><span class='lparen'>(</span><span class='symbol'>:name</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Josh</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span></code></pre>
|
|
1006
1412
|
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1413
|
+
|
|
1414
|
+
<p class="example_title"><div class='inline'><p>A more complicated criteria</p>
|
|
1415
|
+
</div></p>
|
|
1416
|
+
|
|
1417
|
+
<pre class="example code"><code><span class='id identifier rubyid_where'>where</span><span class='lparen'>(</span><span class='symbol'>:name</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Josh</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>created_at.gt</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='const'>DateTime</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='op'>-</span> <span class='int'>1</span><span class='period'>.</span><span class='id identifier rubyid_day'>day</span><span class='rparen'>)</span></code></pre>
|
|
1010
1418
|
|
|
1011
1419
|
</div>
|
|
1012
1420
|
|
|
1013
|
-
<
|
|
1421
|
+
<p class="tag_title">Since:</p>
|
|
1014
1422
|
<ul class="since">
|
|
1015
1423
|
|
|
1016
1424
|
<li>
|
|
@@ -1032,16 +1440,16 @@ an attribute name with a range operator.</p>
|
|
|
1032
1440
|
<pre class="lines">
|
|
1033
1441
|
|
|
1034
1442
|
|
|
1035
|
-
32
|
|
1036
1443
|
33
|
|
1037
1444
|
34
|
|
1038
|
-
35
|
|
1445
|
+
35
|
|
1446
|
+
36</pre>
|
|
1039
1447
|
</td>
|
|
1040
1448
|
<td>
|
|
1041
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line
|
|
1449
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line 33</span>
|
|
1042
1450
|
|
|
1043
1451
|
<span class='kw'>def</span> <span class='id identifier rubyid_where'>where</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
|
1044
|
-
<span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_query'>query</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span><span class='rbrace'>}</span>
|
|
1452
|
+
<span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_query'>query</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span><span class='rbrace'>}</span>
|
|
1045
1453
|
<span class='kw'>self</span>
|
|
1046
1454
|
<span class='kw'>end</span></pre>
|
|
1047
1455
|
</td>
|
|
@@ -1052,11 +1460,11 @@ an attribute name with a range operator.</p>
|
|
|
1052
1460
|
</div>
|
|
1053
1461
|
|
|
1054
1462
|
</div>
|
|
1055
|
-
|
|
1463
|
+
|
|
1056
1464
|
<div id="footer">
|
|
1057
|
-
Generated on Thu
|
|
1465
|
+
Generated on Thu Jun 27 21:59:14 2013 by
|
|
1058
1466
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
1059
|
-
0.
|
|
1467
|
+
0.8.6.1 (ruby-1.9.3).
|
|
1060
1468
|
</div>
|
|
1061
1469
|
|
|
1062
1470
|
</body>
|