| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Paws::DynamoDB::UpdateItem; |
|
3
|
1
|
|
|
1
|
|
405
|
use Moose; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
|
|
has AttributeUpdates => (is => 'ro', isa => 'Paws::DynamoDB::AttributeUpdates'); |
|
5
|
|
|
|
|
|
|
has ConditionalOperator => (is => 'ro', isa => 'Str'); |
|
6
|
|
|
|
|
|
|
has ConditionExpression => (is => 'ro', isa => 'Str'); |
|
7
|
|
|
|
|
|
|
has Expected => (is => 'ro', isa => 'Paws::DynamoDB::ExpectedAttributeMap'); |
|
8
|
|
|
|
|
|
|
has ExpressionAttributeNames => (is => 'ro', isa => 'Paws::DynamoDB::ExpressionAttributeNameMap'); |
|
9
|
|
|
|
|
|
|
has ExpressionAttributeValues => (is => 'ro', isa => 'Paws::DynamoDB::ExpressionAttributeValueMap'); |
|
10
|
|
|
|
|
|
|
has Key => (is => 'ro', isa => 'Paws::DynamoDB::Key', required => 1); |
|
11
|
|
|
|
|
|
|
has ReturnConsumedCapacity => (is => 'ro', isa => 'Str'); |
|
12
|
|
|
|
|
|
|
has ReturnItemCollectionMetrics => (is => 'ro', isa => 'Str'); |
|
13
|
|
|
|
|
|
|
has ReturnValues => (is => 'ro', isa => 'Str'); |
|
14
|
|
|
|
|
|
|
has TableName => (is => 'ro', isa => 'Str', required => 1); |
|
15
|
|
|
|
|
|
|
has UpdateExpression => (is => 'ro', isa => 'Str'); |
|
16
|
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
6238
|
use MooseX::ClassAttribute; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
10
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
class_has _api_call => (isa => 'Str', is => 'ro', default => 'UpdateItem'); |
|
20
|
|
|
|
|
|
|
class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::DynamoDB::UpdateItemOutput'); |
|
21
|
|
|
|
|
|
|
class_has _result_key => (isa => 'Str', is => 'ro'); |
|
22
|
|
|
|
|
|
|
1; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
### main pod documentation begin ### |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 NAME |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Paws::DynamoDB::UpdateItem - Arguments for method UpdateItem on Paws::DynamoDB |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
This class represents the parameters used for calling the method UpdateItem on the |
|
33
|
|
|
|
|
|
|
Amazon DynamoDB service. Use the attributes of this class |
|
34
|
|
|
|
|
|
|
as arguments to method UpdateItem. |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to UpdateItem. |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
As an example: |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
$service_obj->UpdateItem(Att1 => $value1, Att2 => $value2, ...); |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Values for attributes that are native types (Int, String, Float, etc) can passed as-is (scalar values). Values for complex Types (objects) can be passed as a HashRef. The keys and values of the hashref will be used to instance the underlying object. |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 AttributeUpdates => L<Paws::DynamoDB::AttributeUpdates> |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
This is a legacy parameter. Use C<UpdateExpression> instead. For more |
|
50
|
|
|
|
|
|
|
information, see AttributeUpdates in the I<Amazon DynamoDB Developer |
|
51
|
|
|
|
|
|
|
Guide>. |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 ConditionalOperator => Str |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
This is a legacy parameter. Use C<ConditionExpression> instead. For |
|
58
|
|
|
|
|
|
|
more information, see ConditionalOperator in the I<Amazon DynamoDB |
|
59
|
|
|
|
|
|
|
Developer Guide>. |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Valid values are: C<"AND">, C<"OR"> |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 ConditionExpression => Str |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
A condition that must be satisfied in order for a conditional update to |
|
66
|
|
|
|
|
|
|
succeed. |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
An expression can contain any of the following: |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=over |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item * |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Functions: C<attribute_exists | attribute_not_exists | attribute_type | |
|
75
|
|
|
|
|
|
|
contains | begins_with | size> |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
These function names are case-sensitive. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item * |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Comparison operators: C<= | E<lt>E<gt> | E<lt> | E<gt> | E<lt>= | |
|
82
|
|
|
|
|
|
|
E<gt>= | BETWEEN | IN> |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item * |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Logical operators: C<AND | OR | NOT> |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=back |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
For more information on condition expressions, see Specifying |
|
91
|
|
|
|
|
|
|
Conditions in the I<Amazon DynamoDB Developer Guide>. |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head2 Expected => L<Paws::DynamoDB::ExpectedAttributeMap> |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
This is a legacy parameter. Use C<ConditionExpression> instead. For |
|
98
|
|
|
|
|
|
|
more information, see Expected in the I<Amazon DynamoDB Developer |
|
99
|
|
|
|
|
|
|
Guide>. |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head2 ExpressionAttributeNames => L<Paws::DynamoDB::ExpressionAttributeNameMap> |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
One or more substitution tokens for attribute names in an expression. |
|
106
|
|
|
|
|
|
|
The following are some use cases for using C<ExpressionAttributeNames>: |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=over |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=item * |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
To access an attribute whose name conflicts with a DynamoDB reserved |
|
113
|
|
|
|
|
|
|
word. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item * |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
To create a placeholder for repeating occurrences of an attribute name |
|
118
|
|
|
|
|
|
|
in an expression. |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=item * |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
To prevent special characters in an attribute name from being |
|
123
|
|
|
|
|
|
|
misinterpreted in an expression. |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=back |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Use the B<#> character in an expression to dereference an attribute |
|
128
|
|
|
|
|
|
|
name. For example, consider the following attribute name: |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=over |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=item * |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
C<Percentile> |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=back |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
The name of this attribute conflicts with a reserved word, so it cannot |
|
139
|
|
|
|
|
|
|
be used directly in an expression. (For the complete list of reserved |
|
140
|
|
|
|
|
|
|
words, see Reserved Words in the I<Amazon DynamoDB Developer Guide>). |
|
141
|
|
|
|
|
|
|
To work around this, you could specify the following for |
|
142
|
|
|
|
|
|
|
C<ExpressionAttributeNames>: |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=over |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=item * |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
C<{"#P":"Percentile"}> |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=back |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
You could then use this substitution in an expression, as in this |
|
153
|
|
|
|
|
|
|
example: |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=over |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=item * |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
C<#P = :val> |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=back |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Tokens that begin with the B<:> character are I<expression attribute |
|
164
|
|
|
|
|
|
|
values>, which are placeholders for the actual value at runtime. |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
For more information on expression attribute names, see Accessing Item |
|
167
|
|
|
|
|
|
|
Attributes in the I<Amazon DynamoDB Developer Guide>. |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head2 ExpressionAttributeValues => L<Paws::DynamoDB::ExpressionAttributeValueMap> |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
One or more values that can be substituted in an expression. |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
Use the B<:> (colon) character in an expression to dereference an |
|
176
|
|
|
|
|
|
|
attribute value. For example, suppose that you wanted to check whether |
|
177
|
|
|
|
|
|
|
the value of the I<ProductStatus> attribute was one of the following: |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
C<Available | Backordered | Discontinued> |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
You would first need to specify C<ExpressionAttributeValues> as |
|
182
|
|
|
|
|
|
|
follows: |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
C<{ ":avail":{"S":"Available"}, ":back":{"S":"Backordered"}, |
|
185
|
|
|
|
|
|
|
":disc":{"S":"Discontinued"} }> |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
You could then use these values in an expression, such as this: |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
C<ProductStatus IN (:avail, :back, :disc)> |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
For more information on expression attribute values, see Specifying |
|
192
|
|
|
|
|
|
|
Conditions in the I<Amazon DynamoDB Developer Guide>. |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=head2 B<REQUIRED> Key => L<Paws::DynamoDB::Key> |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
The primary key of the item to be updated. Each element consists of an |
|
199
|
|
|
|
|
|
|
attribute name and a value for that attribute. |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
For the primary key, you must provide all of the attributes. For |
|
202
|
|
|
|
|
|
|
example, with a simple primary key, you only need to provide a value |
|
203
|
|
|
|
|
|
|
for the partition key. For a composite primary key, you must provide |
|
204
|
|
|
|
|
|
|
values for both the partition key and the sort key. |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=head2 ReturnConsumedCapacity => Str |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
Valid values are: C<"INDEXES">, C<"TOTAL">, C<"NONE"> |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=head2 ReturnItemCollectionMetrics => Str |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
Determines whether item collection metrics are returned. If set to |
|
217
|
|
|
|
|
|
|
C<SIZE>, the response includes statistics about item collections, if |
|
218
|
|
|
|
|
|
|
any, that were modified during the operation are returned in the |
|
219
|
|
|
|
|
|
|
response. If set to C<NONE> (the default), no statistics are returned. |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
Valid values are: C<"SIZE">, C<"NONE"> |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=head2 ReturnValues => Str |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
Use C<ReturnValues> if you want to get the item attributes as they |
|
226
|
|
|
|
|
|
|
appear before or after they are updated. For C<UpdateItem>, the valid |
|
227
|
|
|
|
|
|
|
values are: |
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=over |
|
230
|
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
=item * |
|
232
|
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
C<NONE> - If C<ReturnValues> is not specified, or if its value is |
|
234
|
|
|
|
|
|
|
C<NONE>, then nothing is returned. (This setting is the default for |
|
235
|
|
|
|
|
|
|
C<ReturnValues>.) |
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=item * |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
C<ALL_OLD> - Returns all of the attributes of the item, as they |
|
240
|
|
|
|
|
|
|
appeared before the UpdateItem operation. |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=item * |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
C<UPDATED_OLD> - Returns only the updated attributes, as they appeared |
|
245
|
|
|
|
|
|
|
before the UpdateItem operation. |
|
246
|
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=item * |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
C<ALL_NEW> - Returns all of the attributes of the item, as they appear |
|
250
|
|
|
|
|
|
|
after the UpdateItem operation. |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=item * |
|
253
|
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
C<UPDATED_NEW> - Returns only the updated attributes, as they appear |
|
255
|
|
|
|
|
|
|
after the UpdateItem operation. |
|
256
|
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
=back |
|
258
|
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
There is no additional cost associated with requesting a return value |
|
260
|
|
|
|
|
|
|
aside from the small network and processing overhead of receiving a |
|
261
|
|
|
|
|
|
|
larger response. No read capacity units are consumed. |
|
262
|
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
The values returned are strongly consistent. |
|
264
|
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
Valid values are: C<"NONE">, C<"ALL_OLD">, C<"UPDATED_OLD">, C<"ALL_NEW">, C<"UPDATED_NEW"> |
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=head2 B<REQUIRED> TableName => Str |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
The name of the table containing the item to update. |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
=head2 UpdateExpression => Str |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
An expression that defines one or more attributes to be updated, the |
|
276
|
|
|
|
|
|
|
action to be performed on them, and new value(s) for them. |
|
277
|
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
The following action values are available for C<UpdateExpression>. |
|
279
|
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=over |
|
281
|
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
=item * |
|
283
|
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
C<SET> - Adds one or more attributes and values to an item. If any of |
|
285
|
|
|
|
|
|
|
these attribute already exist, they are replaced by the new values. You |
|
286
|
|
|
|
|
|
|
can also use C<SET> to add or subtract from an attribute that is of |
|
287
|
|
|
|
|
|
|
type Number. For example: C<SET myNum = myNum + :val> |
|
288
|
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
C<SET> supports the following functions: |
|
290
|
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
=over |
|
292
|
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=item * |
|
294
|
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
C<if_not_exists (path, operand)> - if the item does not contain an |
|
296
|
|
|
|
|
|
|
attribute at the specified path, then C<if_not_exists> evaluates to |
|
297
|
|
|
|
|
|
|
operand; otherwise, it evaluates to path. You can use this function to |
|
298
|
|
|
|
|
|
|
avoid overwriting an attribute that may already be present in the item. |
|
299
|
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
=item * |
|
301
|
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
C<list_append (operand, operand)> - evaluates to a list with a new |
|
303
|
|
|
|
|
|
|
element added to it. You can append the new element to the start or the |
|
304
|
|
|
|
|
|
|
end of the list by reversing the order of the operands. |
|
305
|
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
=back |
|
307
|
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
These function names are case-sensitive. |
|
309
|
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
=item * |
|
311
|
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
C<REMOVE> - Removes one or more attributes from an item. |
|
313
|
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
=item * |
|
315
|
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
C<ADD> - Adds the specified value to the item, if the attribute does |
|
317
|
|
|
|
|
|
|
not already exist. If the attribute does exist, then the behavior of |
|
318
|
|
|
|
|
|
|
C<ADD> depends on the data type of the attribute: |
|
319
|
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
=over |
|
321
|
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
=item * |
|
323
|
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
If the existing attribute is a number, and if C<Value> is also a |
|
325
|
|
|
|
|
|
|
number, then C<Value> is mathematically added to the existing |
|
326
|
|
|
|
|
|
|
attribute. If C<Value> is a negative number, then it is subtracted from |
|
327
|
|
|
|
|
|
|
the existing attribute. |
|
328
|
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
If you use C<ADD> to increment or decrement a number value for an item |
|
330
|
|
|
|
|
|
|
that doesn't exist before the update, DynamoDB uses C<0> as the initial |
|
331
|
|
|
|
|
|
|
value. |
|
332
|
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
Similarly, if you use C<ADD> for an existing item to increment or |
|
334
|
|
|
|
|
|
|
decrement an attribute value that doesn't exist before the update, |
|
335
|
|
|
|
|
|
|
DynamoDB uses C<0> as the initial value. For example, suppose that the |
|
336
|
|
|
|
|
|
|
item you want to update doesn't have an attribute named I<itemcount>, |
|
337
|
|
|
|
|
|
|
but you decide to C<ADD> the number C<3> to this attribute anyway. |
|
338
|
|
|
|
|
|
|
DynamoDB will create the I<itemcount> attribute, set its initial value |
|
339
|
|
|
|
|
|
|
to C<0>, and finally add C<3> to it. The result will be a new |
|
340
|
|
|
|
|
|
|
I<itemcount> attribute in the item, with a value of C<3>. |
|
341
|
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
=item * |
|
343
|
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
If the existing data type is a set and if C<Value> is also a set, then |
|
345
|
|
|
|
|
|
|
C<Value> is added to the existing set. For example, if the attribute |
|
346
|
|
|
|
|
|
|
value is the set C<[1,2]>, and the C<ADD> action specified C<[3]>, then |
|
347
|
|
|
|
|
|
|
the final attribute value is C<[1,2,3]>. An error occurs if an C<ADD> |
|
348
|
|
|
|
|
|
|
action is specified for a set attribute and the attribute type |
|
349
|
|
|
|
|
|
|
specified does not match the existing set type. |
|
350
|
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
Both sets must have the same primitive data type. For example, if the |
|
352
|
|
|
|
|
|
|
existing data type is a set of strings, the C<Value> must also be a set |
|
353
|
|
|
|
|
|
|
of strings. |
|
354
|
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
=back |
|
356
|
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
The C<ADD> action only supports Number and set data types. In addition, |
|
358
|
|
|
|
|
|
|
C<ADD> can only be used on top-level attributes, not nested attributes. |
|
359
|
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
=item * |
|
361
|
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
C<DELETE> - Deletes an element from a set. |
|
363
|
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
If a set of values is specified, then those values are subtracted from |
|
365
|
|
|
|
|
|
|
the old set. For example, if the attribute value was the set C<[a,b,c]> |
|
366
|
|
|
|
|
|
|
and the C<DELETE> action specifies C<[a,c]>, then the final attribute |
|
367
|
|
|
|
|
|
|
value is C<[b]>. Specifying an empty set is an error. |
|
368
|
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
The C<DELETE> action only supports set data types. In addition, |
|
370
|
|
|
|
|
|
|
C<DELETE> can only be used on top-level attributes, not nested |
|
371
|
|
|
|
|
|
|
attributes. |
|
372
|
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
=back |
|
374
|
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
You can have many actions in a single expression, such as the |
|
376
|
|
|
|
|
|
|
following: C<SET a=:value1, b=:value2 DELETE :value3, :value4, :value5> |
|
377
|
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
For more information on update expressions, see Modifying Items and |
|
379
|
|
|
|
|
|
|
Attributes in the I<Amazon DynamoDB Developer Guide>. |
|
380
|
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
385
|
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
This class forms part of L<Paws>, documenting arguments for method UpdateItem in L<Paws::DynamoDB> |
|
387
|
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
=head1 BUGS and CONTRIBUTIONS |
|
389
|
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
The source code is located here: https://github.com/pplu/aws-sdk-perl |
|
391
|
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
Please report bugs to: https://github.com/pplu/aws-sdk-perl/issues |
|
393
|
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
=cut |
|
395
|
|
|
|
|
|
|
|