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
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
6
|
+
<title>
|
|
7
|
+
Module: Dynamoid::Middleware
|
|
8
|
+
|
|
9
|
+
— Documentation by YARD 0.8.6.1
|
|
10
|
+
|
|
11
|
+
</title>
|
|
12
|
+
|
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
|
14
|
+
|
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
|
16
|
+
|
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
|
19
|
+
relpath = '../';
|
|
20
|
+
framesUrl = "../frames.html#!" + escape(window.location.href);
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
|
25
|
+
|
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
</head>
|
|
30
|
+
<body>
|
|
31
|
+
<div id="header">
|
|
32
|
+
<div id="menu">
|
|
33
|
+
|
|
34
|
+
<a href="../_index.html">Index (M)</a> »
|
|
35
|
+
<span class='title'><span class='object_link'><a href="../Dynamoid.html" title="Dynamoid (module)">Dynamoid</a></span></span>
|
|
36
|
+
»
|
|
37
|
+
<span class="title">Middleware</span>
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<div id="search">
|
|
44
|
+
|
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
|
46
|
+
href="../class_list.html">
|
|
47
|
+
Class List
|
|
48
|
+
</a>
|
|
49
|
+
|
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
|
51
|
+
href="../method_list.html">
|
|
52
|
+
Method List
|
|
53
|
+
</a>
|
|
54
|
+
|
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
|
56
|
+
href="../file_list.html">
|
|
57
|
+
File List
|
|
58
|
+
</a>
|
|
59
|
+
|
|
60
|
+
</div>
|
|
61
|
+
<div class="clear"></div>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<iframe id="search_frame"></iframe>
|
|
65
|
+
|
|
66
|
+
<div id="content"><h1>Module: Dynamoid::Middleware
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
</h1>
|
|
71
|
+
|
|
72
|
+
<dl class="box">
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
|
82
|
+
<dd class="r1 last">lib/dynamoid/middleware/identity_map.rb</dd>
|
|
83
|
+
|
|
84
|
+
</dl>
|
|
85
|
+
<div class="clear"></div>
|
|
86
|
+
|
|
87
|
+
<h2>Defined Under Namespace</h2>
|
|
88
|
+
<p class="children">
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Middleware/IdentityMap.html" title="Dynamoid::Middleware::IdentityMap (class)">IdentityMap</a></span>
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
</p>
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
<div id="footer">
|
|
109
|
+
Generated on Thu Jun 27 21:59:13 2013 by
|
|
110
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
111
|
+
0.8.6.1 (ruby-1.9.3).
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
</body>
|
|
115
|
+
</html>
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
6
|
+
<title>
|
|
7
|
+
Class: Dynamoid::Middleware::IdentityMap
|
|
8
|
+
|
|
9
|
+
— Documentation by YARD 0.8.6.1
|
|
10
|
+
|
|
11
|
+
</title>
|
|
12
|
+
|
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
|
|
14
|
+
|
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
|
|
16
|
+
|
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
|
19
|
+
relpath = '../../';
|
|
20
|
+
framesUrl = "../../frames.html#!" + escape(window.location.href);
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
|
25
|
+
|
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
</head>
|
|
30
|
+
<body>
|
|
31
|
+
<div id="header">
|
|
32
|
+
<div id="menu">
|
|
33
|
+
|
|
34
|
+
<a href="../../_index.html">Index (I)</a> »
|
|
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="../Middleware.html" title="Dynamoid::Middleware (module)">Middleware</a></span></span>
|
|
36
|
+
»
|
|
37
|
+
<span class="title">IdentityMap</span>
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<div id="search">
|
|
44
|
+
|
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
|
46
|
+
href="../../class_list.html">
|
|
47
|
+
Class List
|
|
48
|
+
</a>
|
|
49
|
+
|
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
|
51
|
+
href="../../method_list.html">
|
|
52
|
+
Method List
|
|
53
|
+
</a>
|
|
54
|
+
|
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
|
56
|
+
href="../../file_list.html">
|
|
57
|
+
File List
|
|
58
|
+
</a>
|
|
59
|
+
|
|
60
|
+
</div>
|
|
61
|
+
<div class="clear"></div>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<iframe id="search_frame"></iframe>
|
|
65
|
+
|
|
66
|
+
<div id="content"><h1>Class: Dynamoid::Middleware::IdentityMap
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
</h1>
|
|
71
|
+
|
|
72
|
+
<dl class="box">
|
|
73
|
+
|
|
74
|
+
<dt class="r1">Inherits:</dt>
|
|
75
|
+
<dd class="r1">
|
|
76
|
+
<span class="inheritName">Object</span>
|
|
77
|
+
|
|
78
|
+
<ul class="fullTree">
|
|
79
|
+
<li>Object</li>
|
|
80
|
+
|
|
81
|
+
<li class="next">Dynamoid::Middleware::IdentityMap</li>
|
|
82
|
+
|
|
83
|
+
</ul>
|
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
|
85
|
+
|
|
86
|
+
</dd>
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
<dt class="r2 last">Defined in:</dt>
|
|
97
|
+
<dd class="r2 last">lib/dynamoid/middleware/identity_map.rb</dd>
|
|
98
|
+
|
|
99
|
+
</dl>
|
|
100
|
+
<div class="clear"></div>
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
<h2>
|
|
111
|
+
Instance Method Summary
|
|
112
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
|
113
|
+
</h2>
|
|
114
|
+
|
|
115
|
+
<ul class="summary">
|
|
116
|
+
|
|
117
|
+
<li class="public ">
|
|
118
|
+
<span class="summary_signature">
|
|
119
|
+
|
|
120
|
+
<a href="#call-instance_method" title="#call (instance method)">- (Object) <strong>call</strong>(env) </a>
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
</span>
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
135
|
+
|
|
136
|
+
</li>
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
<li class="public ">
|
|
140
|
+
<span class="summary_signature">
|
|
141
|
+
|
|
142
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (IdentityMap) <strong>initialize</strong>(app) </a>
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
</span>
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
<span class="note title constructor">constructor</span>
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
<span class="summary_desc"><div class='inline'><p>A new instance of IdentityMap.</p>
|
|
159
|
+
</div></span>
|
|
160
|
+
|
|
161
|
+
</li>
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
</ul>
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
<div id="constructor_details" class="method_details_list">
|
|
168
|
+
<h2>Constructor Details</h2>
|
|
169
|
+
|
|
170
|
+
<div class="method_details first">
|
|
171
|
+
<h3 class="signature first" id="initialize-instance_method">
|
|
172
|
+
|
|
173
|
+
- (<tt><span class='object_link'><a href="" title="Dynamoid::Middleware::IdentityMap (class)">IdentityMap</a></span></tt>) <strong>initialize</strong>(app)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
</h3><div class="docstring">
|
|
180
|
+
<div class="discussion">
|
|
181
|
+
<p>A new instance of IdentityMap</p>
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
</div>
|
|
185
|
+
</div>
|
|
186
|
+
<div class="tags">
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
</div><table class="source_code">
|
|
190
|
+
<tr>
|
|
191
|
+
<td>
|
|
192
|
+
<pre class="lines">
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
4
|
|
196
|
+
5
|
|
197
|
+
6</pre>
|
|
198
|
+
</td>
|
|
199
|
+
<td>
|
|
200
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/middleware/identity_map.rb', line 4</span>
|
|
201
|
+
|
|
202
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_app'>app</span><span class='rparen'>)</span>
|
|
203
|
+
<span class='ivar'>@app</span> <span class='op'>=</span> <span class='id identifier rubyid_app'>app</span>
|
|
204
|
+
<span class='kw'>end</span></pre>
|
|
205
|
+
</td>
|
|
206
|
+
</tr>
|
|
207
|
+
</table>
|
|
208
|
+
</div>
|
|
209
|
+
|
|
210
|
+
</div>
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
<div id="instance_method_details" class="method_details_list">
|
|
214
|
+
<h2>Instance Method Details</h2>
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
<div class="method_details first">
|
|
218
|
+
<h3 class="signature first" id="call-instance_method">
|
|
219
|
+
|
|
220
|
+
- (<tt>Object</tt>) <strong>call</strong>(env)
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
</h3><table class="source_code">
|
|
227
|
+
<tr>
|
|
228
|
+
<td>
|
|
229
|
+
<pre class="lines">
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
8
|
|
233
|
+
9
|
|
234
|
+
10
|
|
235
|
+
11
|
|
236
|
+
12
|
|
237
|
+
13</pre>
|
|
238
|
+
</td>
|
|
239
|
+
<td>
|
|
240
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/middleware/identity_map.rb', line 8</span>
|
|
241
|
+
|
|
242
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span>
|
|
243
|
+
<span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>IdentityMap</span><span class='period'>.</span><span class='id identifier rubyid_clear'>clear</span>
|
|
244
|
+
<span class='ivar'>@app</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span>
|
|
245
|
+
<span class='kw'>ensure</span>
|
|
246
|
+
<span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>IdentityMap</span><span class='period'>.</span><span class='id identifier rubyid_clear'>clear</span>
|
|
247
|
+
<span class='kw'>end</span></pre>
|
|
248
|
+
</td>
|
|
249
|
+
</tr>
|
|
250
|
+
</table>
|
|
251
|
+
</div>
|
|
252
|
+
|
|
253
|
+
</div>
|
|
254
|
+
|
|
255
|
+
</div>
|
|
256
|
+
|
|
257
|
+
<div id="footer">
|
|
258
|
+
Generated on Thu Jun 27 21:59:14 2013 by
|
|
259
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
260
|
+
0.8.6.1 (ruby-1.9.3).
|
|
261
|
+
</div>
|
|
262
|
+
|
|
263
|
+
</body>
|
|
264
|
+
</html>
|
|
@@ -6,19 +6,21 @@
|
|
|
6
6
|
<title>
|
|
7
7
|
Module: Dynamoid::Persistence
|
|
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 (P)</a> »
|
|
34
|
+
<a href="../_index.html">Index (P)</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">Persistence</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::Persistence
|
|
60
67
|
|
|
61
68
|
|
|
@@ -87,7 +94,7 @@
|
|
|
87
94
|
|
|
88
95
|
<h2>Overview</h2><div class="docstring">
|
|
89
96
|
<div class="discussion">
|
|
90
|
-
<p>Persistence is responsible for dumping objects to and marshalling objects from the datastore. It tries to reserialize
|
|
97
|
+
<p>Persistence is responsible for dumping objects to and marshalling objects from the datastore. It tries to reserialize
|
|
91
98
|
values to be of the same type as when they were passed in, based on the fields in the class.</p>
|
|
92
99
|
|
|
93
100
|
|
|
@@ -98,11 +105,11 @@ values to be of the same type as when they were passed in, based on the fields i
|
|
|
98
105
|
|
|
99
106
|
</div><h2>Defined Under Namespace</h2>
|
|
100
107
|
<p class="children">
|
|
101
|
-
|
|
108
|
+
|
|
102
109
|
|
|
103
110
|
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Persistence/ClassMethods.html" title="Dynamoid::Persistence::ClassMethods (module)">ClassMethods</a></span>
|
|
104
111
|
|
|
105
|
-
|
|
112
|
+
|
|
106
113
|
|
|
107
114
|
|
|
108
115
|
</p>
|
|
@@ -125,6 +132,7 @@ values to be of the same type as when they were passed in, based on the fields i
|
|
|
125
132
|
</span>
|
|
126
133
|
|
|
127
134
|
|
|
135
|
+
|
|
128
136
|
|
|
129
137
|
|
|
130
138
|
|
|
@@ -167,6 +175,7 @@ values to be of the same type as when they were passed in, based on the fields i
|
|
|
167
175
|
|
|
168
176
|
|
|
169
177
|
|
|
178
|
+
|
|
170
179
|
|
|
171
180
|
|
|
172
181
|
<span class="summary_desc"><div class='inline'><p>Delete this object from the datastore and all indexes.</p>
|
|
@@ -189,6 +198,7 @@ values to be of the same type as when they were passed in, based on the fields i
|
|
|
189
198
|
|
|
190
199
|
|
|
191
200
|
|
|
201
|
+
|
|
192
202
|
|
|
193
203
|
|
|
194
204
|
<span class="summary_desc"><div class='inline'><p>Delete this object, but only after running callbacks for it.</p>
|
|
@@ -211,6 +221,7 @@ values to be of the same type as when they were passed in, based on the fields i
|
|
|
211
221
|
|
|
212
222
|
|
|
213
223
|
|
|
224
|
+
|
|
214
225
|
|
|
215
226
|
|
|
216
227
|
<span class="summary_desc"><div class='inline'><p>Dump this object's attributes into hash form, fit to be persisted into the datastore.</p>
|
|
@@ -233,6 +244,7 @@ values to be of the same type as when they were passed in, based on the fields i
|
|
|
233
244
|
|
|
234
245
|
|
|
235
246
|
|
|
247
|
+
|
|
236
248
|
|
|
237
249
|
|
|
238
250
|
<span class="summary_desc"><div class='inline'><p>Is this object persisted in the datastore? Required for some ActiveModel integration stuff.</p>
|
|
@@ -255,11 +267,80 @@ values to be of the same type as when they were passed in, based on the fields i
|
|
|
255
267
|
|
|
256
268
|
|
|
257
269
|
|
|
270
|
+
|
|
258
271
|
|
|
259
272
|
|
|
260
273
|
<span class="summary_desc"><div class='inline'><p>Run the callbacks and then persist this object in the datastore.</p>
|
|
261
274
|
</div></span>
|
|
262
275
|
|
|
276
|
+
</li>
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
<li class="public ">
|
|
280
|
+
<span class="summary_signature">
|
|
281
|
+
|
|
282
|
+
<a href="#touch-instance_method" title="#touch (instance method)">- (Object) <strong>touch</strong>(name = nil) </a>
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
</span>
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
<span class="summary_desc"><div class='inline'><p>Set updated_at and any passed in field to current DateTime.</p>
|
|
297
|
+
</div></span>
|
|
298
|
+
|
|
299
|
+
</li>
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
<li class="public ">
|
|
303
|
+
<span class="summary_signature">
|
|
304
|
+
|
|
305
|
+
<a href="#update-instance_method" title="#update (instance method)">- (Object) <strong>update</strong>(conditions = {}, &block) </a>
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
</span>
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
320
|
+
|
|
321
|
+
</li>
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
<li class="public ">
|
|
325
|
+
<span class="summary_signature">
|
|
326
|
+
|
|
327
|
+
<a href="#update%21-instance_method" title="#update! (instance method)">- (Object) <strong>update!</strong>(conditions = {}, &block) </a>
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
</span>
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
<span class="summary_desc"><div class='inline'><p>update!() will increment the lock_version if the table has the column, but will not check it.</p>
|
|
342
|
+
</div></span>
|
|
343
|
+
|
|
263
344
|
</li>
|
|
264
345
|
|
|
265
346
|
|
|
@@ -273,9 +354,8 @@ values to be of the same type as when they were passed in, based on the fields i
|
|
|
273
354
|
|
|
274
355
|
|
|
275
356
|
<span id="new_record=-instance_method"></span>
|
|
276
|
-
<span id="new_record-instance_method"></span>
|
|
277
357
|
<div class="method_details first">
|
|
278
|
-
<
|
|
358
|
+
<h3 class="signature first" id="new_record-instance_method">
|
|
279
359
|
|
|
280
360
|
- (<tt>Object</tt>) <strong>new_record</strong>
|
|
281
361
|
|
|
@@ -285,7 +365,9 @@ values to be of the same type as when they were passed in, based on the fields i
|
|
|
285
365
|
<span class="names"><span id='new_record?-instance_method'>new_record?</span></span>
|
|
286
366
|
</span>
|
|
287
367
|
|
|
288
|
-
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
</h3><div class="docstring">
|
|
289
371
|
<div class="discussion">
|
|
290
372
|
<p>Returns the value of attribute new_record</p>
|
|
291
373
|
|
|
@@ -321,16 +403,18 @@ values to be of the same type as when they were passed in, based on the fields i
|
|
|
321
403
|
|
|
322
404
|
<div id="instance_method_details" class="method_details_list">
|
|
323
405
|
<h2>Instance Method Details</h2>
|
|
324
|
-
|
|
406
|
+
|
|
325
407
|
|
|
326
408
|
<div class="method_details first">
|
|
327
|
-
<
|
|
409
|
+
<h3 class="signature first" id="delete-instance_method">
|
|
328
410
|
|
|
329
411
|
- (<tt>Object</tt>) <strong>delete</strong>
|
|
330
412
|
|
|
331
413
|
|
|
332
414
|
|
|
333
|
-
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
</h3><div class="docstring">
|
|
334
418
|
<div class="discussion">
|
|
335
419
|
<p>Delete this object from the datastore and all indexes.</p>
|
|
336
420
|
|
|
@@ -339,7 +423,7 @@ values to be of the same type as when they were passed in, based on the fields i
|
|
|
339
423
|
</div>
|
|
340
424
|
<div class="tags">
|
|
341
425
|
|
|
342
|
-
<
|
|
426
|
+
<p class="tag_title">Since:</p>
|
|
343
427
|
<ul class="since">
|
|
344
428
|
|
|
345
429
|
<li>
|
|
@@ -361,17 +445,19 @@ values to be of the same type as when they were passed in, based on the fields i
|
|
|
361
445
|
<pre class="lines">
|
|
362
446
|
|
|
363
447
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
448
|
+
211
|
|
449
|
+
212
|
|
450
|
+
213
|
|
451
|
+
214
|
|
452
|
+
215</pre>
|
|
368
453
|
</td>
|
|
369
454
|
<td>
|
|
370
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line
|
|
455
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 211</span>
|
|
371
456
|
|
|
372
457
|
<span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span>
|
|
373
458
|
<span class='id identifier rubyid_delete_indexes'>delete_indexes</span>
|
|
374
|
-
<span class='
|
|
459
|
+
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_range_key'>range_key</span> <span class='op'>?</span> <span class='lbrace'>{</span><span class='symbol'>:range_key</span> <span class='op'>=></span> <span class='id identifier rubyid_dump_field'>dump_field</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_read_attribute'>read_attribute</span><span class='lparen'>(</span><span class='id identifier rubyid_range_key'>range_key</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span><span class='lbracket'>[</span><span class='id identifier rubyid_range_key'>range_key</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rbrace'>}</span> <span class='op'>:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
|
460
|
+
<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='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_hash_key'>hash_key</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
|
375
461
|
<span class='kw'>end</span></pre>
|
|
376
462
|
</td>
|
|
377
463
|
</tr>
|
|
@@ -379,13 +465,15 @@ values to be of the same type as when they were passed in, based on the fields i
|
|
|
379
465
|
</div>
|
|
380
466
|
|
|
381
467
|
<div class="method_details ">
|
|
382
|
-
<
|
|
468
|
+
<h3 class="signature " id="destroy-instance_method">
|
|
383
469
|
|
|
384
470
|
- (<tt>Object</tt>) <strong>destroy</strong>
|
|
385
471
|
|
|
386
472
|
|
|
387
473
|
|
|
388
|
-
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
</h3><div class="docstring">
|
|
389
477
|
<div class="discussion">
|
|
390
478
|
<p>Delete this object, but only after running callbacks for it.</p>
|
|
391
479
|
|
|
@@ -394,7 +482,7 @@ values to be of the same type as when they were passed in, based on the fields i
|
|
|
394
482
|
</div>
|
|
395
483
|
<div class="tags">
|
|
396
484
|
|
|
397
|
-
<
|
|
485
|
+
<p class="tag_title">Since:</p>
|
|
398
486
|
<ul class="since">
|
|
399
487
|
|
|
400
488
|
<li>
|
|
@@ -416,15 +504,15 @@ values to be of the same type as when they were passed in, based on the fields i
|
|
|
416
504
|
<pre class="lines">
|
|
417
505
|
|
|
418
506
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
507
|
+
201
|
|
508
|
+
202
|
|
509
|
+
203
|
|
510
|
+
204
|
|
511
|
+
205
|
|
512
|
+
206</pre>
|
|
425
513
|
</td>
|
|
426
514
|
<td>
|
|
427
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line
|
|
515
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 201</span>
|
|
428
516
|
|
|
429
517
|
<span class='kw'>def</span> <span class='id identifier rubyid_destroy'>destroy</span>
|
|
430
518
|
<span class='id identifier rubyid_run_callbacks'>run_callbacks</span><span class='lparen'>(</span><span class='symbol'>:destroy</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
|
@@ -438,13 +526,15 @@ values to be of the same type as when they were passed in, based on the fields i
|
|
|
438
526
|
</div>
|
|
439
527
|
|
|
440
528
|
<div class="method_details ">
|
|
441
|
-
<
|
|
529
|
+
<h3 class="signature " id="dump-instance_method">
|
|
442
530
|
|
|
443
531
|
- (<tt>Object</tt>) <strong>dump</strong>
|
|
444
532
|
|
|
445
533
|
|
|
446
534
|
|
|
447
|
-
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
</h3><div class="docstring">
|
|
448
538
|
<div class="discussion">
|
|
449
539
|
<p>Dump this object's attributes into hash form, fit to be persisted into the datastore.</p>
|
|
450
540
|
|
|
@@ -453,7 +543,7 @@ values to be of the same type as when they were passed in, based on the fields i
|
|
|
453
543
|
</div>
|
|
454
544
|
<div class="tags">
|
|
455
545
|
|
|
456
|
-
<
|
|
546
|
+
<p class="tag_title">Since:</p>
|
|
457
547
|
<ul class="since">
|
|
458
548
|
|
|
459
549
|
<li>
|
|
@@ -475,21 +565,21 @@ values to be of the same type as when they were passed in, based on the fields i
|
|
|
475
565
|
<pre class="lines">
|
|
476
566
|
|
|
477
567
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
568
|
+
220
|
|
569
|
+
221
|
|
570
|
+
222
|
|
571
|
+
223
|
|
572
|
+
224
|
|
573
|
+
225
|
|
574
|
+
226</pre>
|
|
485
575
|
</td>
|
|
486
576
|
<td>
|
|
487
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line
|
|
577
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 220</span>
|
|
488
578
|
|
|
489
579
|
<span class='kw'>def</span> <span class='id identifier rubyid_dump'>dump</span>
|
|
490
580
|
<span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_tap'>tap</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_hash'>hash</span><span class='op'>|</span>
|
|
491
581
|
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_attribute'>attribute</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='op'>|</span>
|
|
492
|
-
<span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_dump_field'>dump_field</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_read_attribute'>read_attribute</span><span class='lparen'>(</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='
|
|
582
|
+
<span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_dump_field'>dump_field</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_read_attribute'>read_attribute</span><span class='lparen'>(</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
|
493
583
|
<span class='kw'>end</span>
|
|
494
584
|
<span class='kw'>end</span>
|
|
495
585
|
<span class='kw'>end</span></pre>
|
|
@@ -499,13 +589,15 @@ values to be of the same type as when they were passed in, based on the fields i
|
|
|
499
589
|
</div>
|
|
500
590
|
|
|
501
591
|
<div class="method_details ">
|
|
502
|
-
<
|
|
592
|
+
<h3 class="signature " id="persisted?-instance_method">
|
|
503
593
|
|
|
504
594
|
- (<tt>Boolean</tt>) <strong>persisted?</strong>
|
|
505
595
|
|
|
506
596
|
|
|
507
597
|
|
|
508
|
-
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
</h3><div class="docstring">
|
|
509
601
|
<div class="discussion">
|
|
510
602
|
<p>Is this object persisted in the datastore? Required for some ActiveModel integration stuff.</p>
|
|
511
603
|
|
|
@@ -514,7 +606,7 @@ values to be of the same type as when they were passed in, based on the fields i
|
|
|
514
606
|
</div>
|
|
515
607
|
<div class="tags">
|
|
516
608
|
|
|
517
|
-
<
|
|
609
|
+
<p class="tag_title">Returns:</p>
|
|
518
610
|
<ul class="return">
|
|
519
611
|
|
|
520
612
|
<li>
|
|
@@ -527,7 +619,7 @@ values to be of the same type as when they were passed in, based on the fields i
|
|
|
527
619
|
</li>
|
|
528
620
|
|
|
529
621
|
</ul>
|
|
530
|
-
<
|
|
622
|
+
<p class="tag_title">Since:</p>
|
|
531
623
|
<ul class="since">
|
|
532
624
|
|
|
533
625
|
<li>
|
|
@@ -549,12 +641,12 @@ values to be of the same type as when they were passed in, based on the fields i
|
|
|
549
641
|
<pre class="lines">
|
|
550
642
|
|
|
551
643
|
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
644
|
+
149
|
|
645
|
+
150
|
|
646
|
+
151</pre>
|
|
555
647
|
</td>
|
|
556
648
|
<td>
|
|
557
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line
|
|
649
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 149</span>
|
|
558
650
|
|
|
559
651
|
<span class='kw'>def</span> <span class='id identifier rubyid_persisted?'>persisted?</span>
|
|
560
652
|
<span class='op'>!</span><span class='id identifier rubyid_new_record?'>new_record?</span>
|
|
@@ -565,13 +657,15 @@ values to be of the same type as when they were passed in, based on the fields i
|
|
|
565
657
|
</div>
|
|
566
658
|
|
|
567
659
|
<div class="method_details ">
|
|
568
|
-
<
|
|
660
|
+
<h3 class="signature " id="save-instance_method">
|
|
569
661
|
|
|
570
662
|
- (<tt>Object</tt>) <strong>save</strong>(options = {})
|
|
571
663
|
|
|
572
664
|
|
|
573
665
|
|
|
574
|
-
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
</h3><div class="docstring">
|
|
575
669
|
<div class="discussion">
|
|
576
670
|
<p>Run the callbacks and then persist this object in the datastore.</p>
|
|
577
671
|
|
|
@@ -580,7 +674,7 @@ values to be of the same type as when they were passed in, based on the fields i
|
|
|
580
674
|
</div>
|
|
581
675
|
<div class="tags">
|
|
582
676
|
|
|
583
|
-
<
|
|
677
|
+
<p class="tag_title">Since:</p>
|
|
584
678
|
<ul class="since">
|
|
585
679
|
|
|
586
680
|
<li>
|
|
@@ -602,30 +696,32 @@ values to be of the same type as when they were passed in, based on the fields i
|
|
|
602
696
|
<pre class="lines">
|
|
603
697
|
|
|
604
698
|
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
699
|
+
156
|
|
700
|
+
157
|
|
701
|
+
158
|
|
702
|
+
159
|
|
703
|
+
160
|
|
704
|
+
161
|
|
705
|
+
162
|
|
706
|
+
163
|
|
707
|
+
164
|
|
708
|
+
165
|
|
709
|
+
166
|
|
710
|
+
167
|
|
711
|
+
168
|
|
712
|
+
169</pre>
|
|
618
713
|
</td>
|
|
619
714
|
<td>
|
|
620
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line
|
|
715
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 156</span>
|
|
621
716
|
|
|
622
717
|
<span class='kw'>def</span> <span class='id identifier rubyid_save'>save</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
|
623
718
|
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_create_table'>create_table</span>
|
|
624
|
-
|
|
625
|
-
<span class='ivar'>@previously_changed</span> <span class='op'>=</span> <span class='id identifier rubyid_changes'>changes</span>
|
|
626
|
-
|
|
719
|
+
|
|
627
720
|
<span class='kw'>if</span> <span class='id identifier rubyid_new_record?'>new_record?</span>
|
|
628
|
-
<span class='id identifier
|
|
721
|
+
<span class='id identifier rubyid_conditions'>conditions</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='symbol'>:unless_exists</span> <span class='op'>=></span> <span class='lbracket'>[</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_hash_key'>hash_key</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
|
|
722
|
+
<span class='id identifier rubyid_conditions'>conditions</span><span class='lbracket'>[</span><span class='symbol'>:unless_exists</span><span class='rbracket'>]</span> <span class='op'><<</span> <span class='id identifier rubyid_range_key'>range_key</span> <span class='kw'>if</span><span class='lparen'>(</span><span class='id identifier rubyid_range_key'>range_key</span><span class='rparen'>)</span>
|
|
723
|
+
|
|
724
|
+
<span class='id identifier rubyid_run_callbacks'>run_callbacks</span><span class='lparen'>(</span><span class='symbol'>:create</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_persist'>persist</span><span class='lparen'>(</span><span class='id identifier rubyid_conditions'>conditions</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
|
629
725
|
<span class='kw'>else</span>
|
|
630
726
|
<span class='id identifier rubyid_persist'>persist</span>
|
|
631
727
|
<span class='kw'>end</span>
|
|
@@ -637,14 +733,159 @@ values to be of the same type as when they were passed in, based on the fields i
|
|
|
637
733
|
</table>
|
|
638
734
|
</div>
|
|
639
735
|
|
|
736
|
+
<div class="method_details ">
|
|
737
|
+
<h3 class="signature " id="touch-instance_method">
|
|
738
|
+
|
|
739
|
+
- (<tt>Object</tt>) <strong>touch</strong>(name = nil)
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
|
|
744
|
+
|
|
745
|
+
</h3><div class="docstring">
|
|
746
|
+
<div class="discussion">
|
|
747
|
+
<p>Set updated_at and any passed in field to current DateTime. Useful for things like last_login_at, etc.</p>
|
|
748
|
+
|
|
749
|
+
|
|
750
|
+
</div>
|
|
751
|
+
</div>
|
|
752
|
+
<div class="tags">
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
</div><table class="source_code">
|
|
756
|
+
<tr>
|
|
757
|
+
<td>
|
|
758
|
+
<pre class="lines">
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
139
|
|
762
|
+
140
|
|
763
|
+
141
|
|
764
|
+
142
|
|
765
|
+
143
|
|
766
|
+
144</pre>
|
|
767
|
+
</td>
|
|
768
|
+
<td>
|
|
769
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 139</span>
|
|
770
|
+
|
|
771
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_touch'>touch</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
|
772
|
+
<span class='id identifier rubyid_now'>now</span> <span class='op'>=</span> <span class='const'>DateTime</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span>
|
|
773
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_updated_at'>updated_at</span> <span class='op'>=</span> <span class='id identifier rubyid_now'>now</span>
|
|
774
|
+
<span class='id identifier rubyid_attributes'>attributes</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_now'>now</span> <span class='kw'>if</span> <span class='id identifier rubyid_name'>name</span>
|
|
775
|
+
<span class='id identifier rubyid_save'>save</span>
|
|
776
|
+
<span class='kw'>end</span></pre>
|
|
777
|
+
</td>
|
|
778
|
+
</tr>
|
|
779
|
+
</table>
|
|
780
|
+
</div>
|
|
781
|
+
|
|
782
|
+
<div class="method_details ">
|
|
783
|
+
<h3 class="signature " id="update-instance_method">
|
|
784
|
+
|
|
785
|
+
- (<tt>Object</tt>) <strong>update</strong>(conditions = {}, &block)
|
|
786
|
+
|
|
787
|
+
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
</h3><table class="source_code">
|
|
792
|
+
<tr>
|
|
793
|
+
<td>
|
|
794
|
+
<pre class="lines">
|
|
795
|
+
|
|
796
|
+
|
|
797
|
+
191
|
|
798
|
+
192
|
|
799
|
+
193
|
|
800
|
+
194
|
|
801
|
+
195
|
|
802
|
+
196</pre>
|
|
803
|
+
</td>
|
|
804
|
+
<td>
|
|
805
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 191</span>
|
|
806
|
+
|
|
807
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_update'>update</span><span class='lparen'>(</span><span class='id identifier rubyid_conditions'>conditions</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
|
808
|
+
<span class='id identifier rubyid_update!'>update!</span><span class='lparen'>(</span><span class='id identifier rubyid_conditions'>conditions</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
|
809
|
+
<span class='kw'>true</span>
|
|
810
|
+
<span class='kw'>rescue</span> <span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Errors</span><span class='op'>::</span><span class='const'>ConditionalCheckFailedException</span>
|
|
811
|
+
<span class='kw'>false</span>
|
|
812
|
+
<span class='kw'>end</span></pre>
|
|
813
|
+
</td>
|
|
814
|
+
</tr>
|
|
815
|
+
</table>
|
|
816
|
+
</div>
|
|
817
|
+
|
|
818
|
+
<div class="method_details ">
|
|
819
|
+
<h3 class="signature " id="update!-instance_method">
|
|
820
|
+
|
|
821
|
+
- (<tt>Object</tt>) <strong>update!</strong>(conditions = {}, &block)
|
|
822
|
+
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
</h3><div class="docstring">
|
|
828
|
+
<div class="discussion">
|
|
829
|
+
<p>update!() will increment the lock_version if the table has the column, but will not check it. Thus, a concurrent save will
|
|
830
|
+
never cause an update! to fail, but an update! may cause a concurrent save to fail.</p>
|
|
831
|
+
|
|
832
|
+
|
|
640
833
|
</div>
|
|
834
|
+
</div>
|
|
835
|
+
<div class="tags">
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
</div><table class="source_code">
|
|
839
|
+
<tr>
|
|
840
|
+
<td>
|
|
841
|
+
<pre class="lines">
|
|
842
|
+
|
|
641
843
|
|
|
844
|
+
176
|
|
845
|
+
177
|
|
846
|
+
178
|
|
847
|
+
179
|
|
848
|
+
180
|
|
849
|
+
181
|
|
850
|
+
182
|
|
851
|
+
183
|
|
852
|
+
184
|
|
853
|
+
185
|
|
854
|
+
186
|
|
855
|
+
187
|
|
856
|
+
188
|
|
857
|
+
189</pre>
|
|
858
|
+
</td>
|
|
859
|
+
<td>
|
|
860
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 176</span>
|
|
861
|
+
|
|
862
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_update!'>update!</span><span class='lparen'>(</span><span class='id identifier rubyid_conditions'>conditions</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
|
863
|
+
<span class='id identifier rubyid_run_callbacks'>run_callbacks</span><span class='lparen'>(</span><span class='symbol'>:update</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
|
864
|
+
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_range_key'>range_key</span> <span class='op'>?</span> <span class='lbrace'>{</span><span class='symbol'>:range_key</span> <span class='op'>=></span> <span class='id identifier rubyid_dump_field'>dump_field</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_read_attribute'>read_attribute</span><span class='lparen'>(</span><span class='id identifier rubyid_range_key'>range_key</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span><span class='lbracket'>[</span><span class='id identifier rubyid_range_key'>range_key</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rbrace'>}</span> <span class='op'>:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
|
865
|
+
<span class='id identifier rubyid_new_attrs'>new_attrs</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_update_item'>update_item</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_hash_key'>hash_key</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='symbol'>:conditions</span> <span class='op'>=></span> <span class='id identifier rubyid_conditions'>conditions</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_t'>t</span><span class='op'>|</span>
|
|
866
|
+
<span class='kw'>if</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span><span class='lbracket'>[</span><span class='symbol'>:lock_version</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
|
867
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Optimistic locking cannot be used with Partitioning</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span><span class='lparen'>(</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><span class='rparen'>)</span>
|
|
868
|
+
<span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='label'>lock_version:</span> <span class='int'>1</span><span class='rparen'>)</span>
|
|
869
|
+
<span class='kw'>end</span>
|
|
870
|
+
|
|
871
|
+
<span class='kw'>yield</span> <span class='id identifier rubyid_t'>t</span>
|
|
872
|
+
<span class='kw'>end</span>
|
|
873
|
+
<span class='id identifier rubyid_load'>load</span><span class='lparen'>(</span><span class='id identifier rubyid_new_attrs'>new_attrs</span><span class='rparen'>)</span>
|
|
874
|
+
<span class='kw'>end</span>
|
|
875
|
+
<span class='kw'>end</span></pre>
|
|
876
|
+
</td>
|
|
877
|
+
</tr>
|
|
878
|
+
</table>
|
|
642
879
|
</div>
|
|
643
880
|
|
|
881
|
+
</div>
|
|
882
|
+
|
|
883
|
+
</div>
|
|
884
|
+
|
|
644
885
|
<div id="footer">
|
|
645
|
-
Generated on Thu
|
|
886
|
+
Generated on Thu Jun 27 21:59:13 2013 by
|
|
646
887
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
647
|
-
0.
|
|
888
|
+
0.8.6.1 (ruby-1.9.3).
|
|
648
889
|
</div>
|
|
649
890
|
|
|
650
891
|
</body>
|