blib/lib/Paws/DynamoDB/Query.pm untested

filter: Statementstmt 0.0% 0 / 26 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 2 Podpod n/a totaltotal 0.0% 0 / 28 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1  
2 package Paws::DynamoDB::Query;
3 use Moose;
4 has AttributesToGet => (is => 'ro', isa => 'ArrayRef[Str|Undef]');
5 has ConditionalOperator => (is => 'ro', isa => 'Str');
6 has ConsistentRead => (is => 'ro', isa => 'Bool');
7 has ExclusiveStartKey => (is => 'ro', isa => 'Paws::DynamoDB::Key');
8 has ExpressionAttributeNames => (is => 'ro', isa => 'Paws::DynamoDB::ExpressionAttributeNameMap');
9 has ExpressionAttributeValues => (is => 'ro', isa => 'Paws::DynamoDB::ExpressionAttributeValueMap');
10 has FilterExpression => (is => 'ro', isa => 'Str');
11 has IndexName => (is => 'ro', isa => 'Str');
12 has KeyConditionExpression => (is => 'ro', isa => 'Str');
13 has KeyConditions => (is => 'ro', isa => 'Paws::DynamoDB::KeyConditions');
14 has Limit => (is => 'ro', isa => 'Int');
15 has ProjectionExpression => (is => 'ro', isa => 'Str');
16 has QueryFilter => (is => 'ro', isa => 'Paws::DynamoDB::FilterConditionMap');
17 has ReturnConsumedCapacity => (is => 'ro', isa => 'Str');
18 has ScanIndexForward => (is => 'ro', isa => 'Bool');
19 has Select => (is => 'ro', isa => 'Str');
20 has TableName => (is => 'ro', isa => 'Str', required => 1);
21  
22 use MooseX::ClassAttribute;
23  
24 class_has _api_call => (isa => 'Str', is => 'ro', default => 'Query');
25 class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::DynamoDB::QueryOutput');
26 class_has _result_key => (isa => 'Str', is => 'ro');
27 1;
28  
29 ### main pod documentation begin ###
30  
31 =head1 NAME
32  
33 Paws::DynamoDB::Query - Arguments for method Query on L<Paws::DynamoDB>
34  
35 =head1 DESCRIPTION
36  
37 This class represents the parameters used for calling the method Query on the
38 L<Amazon DynamoDB|Paws::DynamoDB> service. Use the attributes of this class
39 as arguments to method Query.
40  
41 You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to Query.
42  
43 =head1 SYNOPSIS
44  
45 my $dynamodb = Paws->service('DynamoDB');
46 # To query an item
47 # This example queries items in the Music table. The table has a partition key
48 # and sort key (Artist and SongTitle), but this query only specifies the
49 # partition key value. It returns song titles by the artist named "No One You
50 # Know".
51 my $QueryOutput = $dynamodb->Query(
52 'ExpressionAttributeValues' => {
53 ':v1' => {
54 'S' => 'No One You Know'
55 }
56 },
57 'KeyConditionExpression' => 'Artist = :v1',
58 'ProjectionExpression' => 'SongTitle',
59 'TableName' => 'Music'
60 );
61  
62 # Results:
63 my $ConsumedCapacity = $QueryOutput->ConsumedCapacity;
64 my $Count = $QueryOutput->Count;
65 my $Items = $QueryOutput->Items;
66 my $ScannedCount = $QueryOutput->ScannedCount;
67  
68 # Returns a L<Paws::DynamoDB::QueryOutput> object.
69  
70 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.
71 For the AWS API documentation, see L<https://docs.aws.amazon.com/goto/WebAPI/dynamodb/Query>
72  
73 =head1 ATTRIBUTES
74  
75  
76 =head2 AttributesToGet => ArrayRef[Str|Undef]
77  
78 This is a legacy parameter. Use C<ProjectionExpression> instead. For
79 more information, see AttributesToGet
80 (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributesToGet.html)
81 in the I<Amazon DynamoDB Developer Guide>.
82  
83  
84  
85 =head2 ConditionalOperator => Str
86  
87 This is a legacy parameter. Use C<FilterExpression> instead. For more
88 information, see ConditionalOperator
89 (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.ConditionalOperator.html)
90 in the I<Amazon DynamoDB Developer Guide>.
91  
92 Valid values are: C<"AND">, C<"OR">
93  
94 =head2 ConsistentRead => Bool
95  
96 Determines the read consistency model: If set to C<true>, then the
97 operation uses strongly consistent reads; otherwise, the operation uses
98 eventually consistent reads.
99  
100 Strongly consistent reads are not supported on global secondary
101 indexes. If you query a global secondary index with C<ConsistentRead>
102 set to C<true>, you will receive a C<ValidationException>.
103  
104  
105  
106 =head2 ExclusiveStartKey => L<Paws::DynamoDB::Key>
107  
108 The primary key of the first item that this operation will evaluate.
109 Use the value that was returned for C<LastEvaluatedKey> in the previous
110 operation.
111  
112 The data type for C<ExclusiveStartKey> must be String, Number, or
113 Binary. No set data types are allowed.
114  
115  
116  
117 =head2 ExpressionAttributeNames => L<Paws::DynamoDB::ExpressionAttributeNameMap>
118  
119 One or more substitution tokens for attribute names in an expression.
120 The following are some use cases for using C<ExpressionAttributeNames>:
121  
122 =over
123  
124 =item *
125  
126 To access an attribute whose name conflicts with a DynamoDB reserved
127 word.
128  
129 =item *
130  
131 To create a placeholder for repeating occurrences of an attribute name
132 in an expression.
133  
134 =item *
135  
136 To prevent special characters in an attribute name from being
137 misinterpreted in an expression.
138  
139 =back
140  
141 Use the B<#> character in an expression to dereference an attribute
142 name. For example, consider the following attribute name:
143  
144 =over
145  
146 =item *
147  
148 C<Percentile>
149  
150 =back
151  
152 The name of this attribute conflicts with a reserved word, so it cannot
153 be used directly in an expression. (For the complete list of reserved
154 words, see Reserved Words
155 (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html)
156 in the I<Amazon DynamoDB Developer Guide>). To work around this, you
157 could specify the following for C<ExpressionAttributeNames>:
158  
159 =over
160  
161 =item *
162  
163 C<{"#P":"Percentile"}>
164  
165 =back
166  
167 You could then use this substitution in an expression, as in this
168 example:
169  
170 =over
171  
172 =item *
173  
174 C<#P = :val>
175  
176 =back
177  
178 Tokens that begin with the B<:> character are I<expression attribute
179 values>, which are placeholders for the actual value at runtime.
180  
181 For more information on expression attribute names, see Specifying Item
182 Attributes
183 (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html)
184 in the I<Amazon DynamoDB Developer Guide>.
185  
186  
187  
188 =head2 ExpressionAttributeValues => L<Paws::DynamoDB::ExpressionAttributeValueMap>
189  
190 One or more values that can be substituted in an expression.
191  
192 Use the B<:> (colon) character in an expression to dereference an
193 attribute value. For example, suppose that you wanted to check whether
194 the value of the I<ProductStatus> attribute was one of the following:
195  
196 C<Available | Backordered | Discontinued>
197  
198 You would first need to specify C<ExpressionAttributeValues> as
199 follows:
200  
201 C<{ ":avail":{"S":"Available"}, ":back":{"S":"Backordered"},
202 ":disc":{"S":"Discontinued"} }>
203  
204 You could then use these values in an expression, such as this:
205  
206 C<ProductStatus IN (:avail, :back, :disc)>
207  
208 For more information on expression attribute values, see Specifying
209 Conditions
210 (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html)
211 in the I<Amazon DynamoDB Developer Guide>.
212  
213  
214  
215 =head2 FilterExpression => Str
216  
217 A string that contains conditions that DynamoDB applies after the
218 C<Query> operation, but before the data is returned to you. Items that
219 do not satisfy the C<FilterExpression> criteria are not returned.
220  
221 A C<FilterExpression> does not allow key attributes. You cannot define
222 a filter expression based on a partition key or a sort key.
223  
224 A C<FilterExpression> is applied after the items have already been
225 read; the process of filtering does not consume any additional read
226 capacity units.
227  
228 For more information, see Filter Expressions
229 (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html#FilteringResults)
230 in the I<Amazon DynamoDB Developer Guide>.
231  
232  
233  
234 =head2 IndexName => Str
235  
236 The name of an index to query. This index can be any local secondary
237 index or global secondary index on the table. Note that if you use the
238 C<IndexName> parameter, you must also provide C<TableName.>
239  
240  
241  
242 =head2 KeyConditionExpression => Str
243  
244 The condition that specifies the key values for items to be retrieved
245 by the C<Query> action.
246  
247 The condition must perform an equality test on a single partition key
248 value.
249  
250 The condition can optionally perform one of several comparison tests on
251 a single sort key value. This allows C<Query> to retrieve one item with
252 a given partition key value and sort key value, or several items that
253 have the same partition key value but different sort key values.
254  
255 The partition key equality test is required, and must be specified in
256 the following format:
257  
258 C<partitionKeyName> I<=> C<:partitionkeyval>
259  
260 If you also want to provide a condition for the sort key, it must be
261 combined using C<AND> with the condition for the sort key. Following is
262 an example, using the B<=> comparison operator for the sort key:
263  
264 C<partitionKeyName> C<=> C<:partitionkeyval> C<AND> C<sortKeyName> C<=>
265 C<:sortkeyval>
266  
267 Valid comparisons for the sort key condition are as follows:
268  
269 =over
270  
271 =item *
272  
273 C<sortKeyName> C<=> C<:sortkeyval> - true if the sort key value is
274 equal to C<:sortkeyval>.
275  
276 =item *
277  
278 C<sortKeyName> C<E<lt>> C<:sortkeyval> - true if the sort key value is
279 less than C<:sortkeyval>.
280  
281 =item *
282  
283 C<sortKeyName> C<E<lt>=> C<:sortkeyval> - true if the sort key value is
284 less than or equal to C<:sortkeyval>.
285  
286 =item *
287  
288 C<sortKeyName> C<E<gt>> C<:sortkeyval> - true if the sort key value is
289 greater than C<:sortkeyval>.
290  
291 =item *
292  
293 C<sortKeyName> C<E<gt>= > C<:sortkeyval> - true if the sort key value
294 is greater than or equal to C<:sortkeyval>.
295  
296 =item *
297  
298 C<sortKeyName> C<BETWEEN> C<:sortkeyval1> C<AND> C<:sortkeyval2> - true
299 if the sort key value is greater than or equal to C<:sortkeyval1>, and
300 less than or equal to C<:sortkeyval2>.
301  
302 =item *
303  
304 C<begins_with (> C<sortKeyName>, C<:sortkeyval> C<)> - true if the sort
305 key value begins with a particular operand. (You cannot use this
306 function with a sort key that is of type Number.) Note that the
307 function name C<begins_with> is case-sensitive.
308  
309 =back
310  
311 Use the C<ExpressionAttributeValues> parameter to replace tokens such
312 as C<:partitionval> and C<:sortval> with actual values at runtime.
313  
314 You can optionally use the C<ExpressionAttributeNames> parameter to
315 replace the names of the partition key and sort key with placeholder
316 tokens. This option might be necessary if an attribute name conflicts
317 with a DynamoDB reserved word. For example, the following
318 C<KeyConditionExpression> parameter causes an error because I<Size> is
319 a reserved word:
320  
321 =over
322  
323 =item *
324  
325 C<Size = :myval>
326  
327 =back
328  
329 To work around this, define a placeholder (such a C<#S>) to represent
330 the attribute name I<Size>. C<KeyConditionExpression> then is as
331 follows:
332  
333 =over
334  
335 =item *
336  
337 C<#S = :myval>
338  
339 =back
340  
341 For a list of reserved words, see Reserved Words
342 (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html)
343 in the I<Amazon DynamoDB Developer Guide>.
344  
345 For more information on C<ExpressionAttributeNames> and
346 C<ExpressionAttributeValues>, see Using Placeholders for Attribute
347 Names and Values
348 (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ExpressionPlaceholders.html)
349 in the I<Amazon DynamoDB Developer Guide>.
350  
351  
352  
353 =head2 KeyConditions => L<Paws::DynamoDB::KeyConditions>
354  
355 This is a legacy parameter. Use C<KeyConditionExpression> instead. For
356 more information, see KeyConditions
357 (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.KeyConditions.html)
358 in the I<Amazon DynamoDB Developer Guide>.
359  
360  
361  
362 =head2 Limit => Int
363  
364 The maximum number of items to evaluate (not necessarily the number of
365 matching items). If DynamoDB processes the number of items up to the
366 limit while processing the results, it stops the operation and returns
367 the matching values up to that point, and a key in C<LastEvaluatedKey>
368 to apply in a subsequent operation, so that you can pick up where you
369 left off. Also, if the processed dataset size exceeds 1 MB before
370 DynamoDB reaches this limit, it stops the operation and returns the
371 matching values up to the limit, and a key in C<LastEvaluatedKey> to
372 apply in a subsequent operation to continue the operation. For more
373 information, see Query and Scan
374 (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/QueryAndScan.html)
375 in the I<Amazon DynamoDB Developer Guide>.
376  
377  
378  
379 =head2 ProjectionExpression => Str
380  
381 A string that identifies one or more attributes to retrieve from the
382 table. These attributes can include scalars, sets, or elements of a
383 JSON document. The attributes in the expression must be separated by
384 commas.
385  
386 If no attribute names are specified, then all attributes will be
387 returned. If any of the requested attributes are not found, they will
388 not appear in the result.
389  
390 For more information, see Accessing Item Attributes
391 (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.AccessingItemAttributes.html)
392 in the I<Amazon DynamoDB Developer Guide>.
393  
394  
395  
396 =head2 QueryFilter => L<Paws::DynamoDB::FilterConditionMap>
397  
398 This is a legacy parameter. Use C<FilterExpression> instead. For more
399 information, see QueryFilter
400 (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.QueryFilter.html)
401 in the I<Amazon DynamoDB Developer Guide>.
402  
403  
404  
405 =head2 ReturnConsumedCapacity => Str
406  
407  
408  
409 Valid values are: C<"INDEXES">, C<"TOTAL">, C<"NONE">
410  
411 =head2 ScanIndexForward => Bool
412  
413 Specifies the order for index traversal: If C<true> (default), the
414 traversal is performed in ascending order; if C<false>, the traversal
415 is performed in descending order.
416  
417 Items with the same partition key value are stored in sorted order by
418 sort key. If the sort key data type is Number, the results are stored
419 in numeric order. For type String, the results are stored in order of
420 UTF-8 bytes. For type Binary, DynamoDB treats each byte of the binary
421 data as unsigned.
422  
423 If C<ScanIndexForward> is C<true>, DynamoDB returns the results in the
424 order in which they are stored (by sort key value). This is the default
425 behavior. If C<ScanIndexForward> is C<false>, DynamoDB reads the
426 results in reverse order by sort key value, and then returns the
427 results to the client.
428  
429  
430  
431 =head2 Select => Str
432  
433 The attributes to be returned in the result. You can retrieve all item
434 attributes, specific item attributes, the count of matching items, or
435 in the case of an index, some or all of the attributes projected into
436 the index.
437  
438 =over
439  
440 =item *
441  
442 C<ALL_ATTRIBUTES> - Returns all of the item attributes from the
443 specified table or index. If you query a local secondary index, then
444 for each matching item in the index, DynamoDB fetches the entire item
445 from the parent table. If the index is configured to project all item
446 attributes, then all of the data can be obtained from the local
447 secondary index, and no fetching is required.
448  
449 =item *
450  
451 C<ALL_PROJECTED_ATTRIBUTES> - Allowed only when querying an index.
452 Retrieves all attributes that have been projected into the index. If
453 the index is configured to project all attributes, this return value is
454 equivalent to specifying C<ALL_ATTRIBUTES>.
455  
456 =item *
457  
458 C<COUNT> - Returns the number of matching items, rather than the
459 matching items themselves.
460  
461 =item *
462  
463 C<SPECIFIC_ATTRIBUTES> - Returns only the attributes listed in
464 C<AttributesToGet>. This return value is equivalent to specifying
465 C<AttributesToGet> without specifying any value for C<Select>.
466  
467 If you query or scan a local secondary index and request only
468 attributes that are projected into that index, the operation will read
469 only the index and not the table. If any of the requested attributes
470 are not projected into the local secondary index, DynamoDB fetches each
471 of these attributes from the parent table. This extra fetching incurs
472 additional throughput cost and latency.
473  
474 If you query or scan a global secondary index, you can only request
475 attributes that are projected into the index. Global secondary index
476 queries cannot fetch attributes from the parent table.
477  
478 =back
479  
480 If neither C<Select> nor C<AttributesToGet> are specified, DynamoDB
481 defaults to C<ALL_ATTRIBUTES> when accessing a table, and
482 C<ALL_PROJECTED_ATTRIBUTES> when accessing an index. You cannot use
483 both C<Select> and C<AttributesToGet> together in a single request,
484 unless the value for C<Select> is C<SPECIFIC_ATTRIBUTES>. (This usage
485 is equivalent to specifying C<AttributesToGet> without any value for
486 C<Select>.)
487  
488 If you use the C<ProjectionExpression> parameter, then the value for
489 C<Select> can only be C<SPECIFIC_ATTRIBUTES>. Any other value for
490 C<Select> will return an error.
491  
492 Valid values are: C<"ALL_ATTRIBUTES">, C<"ALL_PROJECTED_ATTRIBUTES">, C<"SPECIFIC_ATTRIBUTES">, C<"COUNT">
493  
494 =head2 B<REQUIRED> TableName => Str
495  
496 The name of the table containing the requested items.
497  
498  
499  
500  
501 =head1 SEE ALSO
502  
503 This class forms part of L<Paws>, documenting arguments for method Query in L<Paws::DynamoDB>
504  
505 =head1 BUGS and CONTRIBUTIONS
506  
507 The source code is located here: L<https://github.com/pplu/aws-sdk-perl>
508  
509 Please report bugs to: L<https://github.com/pplu/aws-sdk-perl/issues>
510  
511 =cut
512