Amazon-DynamoDB
view release on metacpan or search on metacpan
lib/Amazon/DynamoDB/#Types.pm# view on Meta::CPAN
(exists($_->{Exists}) || exists($_->{Value})))
};
declare ExpectedType, as Map[AttributeNameType, ExpectedValueType];
coerce ExpectedType, from HashRef, via { ExpectedType->new($_) };
declare AttributeUpdatesType, as Map[AttributeNameType, Dict[Action => StrMatch[qr/^(PUT|DELETE|ADD)$/],
Value => Optional[AttributeValueType]]];
coerce AttributeUpdatesType, from HashRef, via { AttributeUpdatesType->new($_); };
declare ItemType, as Map[AttributeNameType, AttributeValueType];
declare KeyType, as Map[AttributeNameType, AttributeValueType], where { scalar(keys %$_) > 0 && scalar(keys %$_) < 3 };
declare BatchWritePutItemType, as Dict[PutRequest => Dict[Item => ItemType]];
declare BatchWriteDeleteItemType, as Dict[DeleteRequest => Dict[Key => KeyType]];
declare BatchWriteRequestItemsType, as Map[TableNameType, ArrayRef[BatchWritePutItemType|BatchWriteDeleteItemType]], where { scalar(keys %$_) > 0 };
lib/Amazon/DynamoDB/20120810.pm view on Meta::CPAN
L<http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html>
$ddb->update_item(
TableName => $table_name,
Key => {
user_id => 2
},
AttributeUpdates => {
name => {
Action => 'PUT',
Value => "Rusty Conover-3",
},
favorite_color => {
Action => 'DELETE'
},
test_numbers => {
Action => 'DELETE',
Value => [500]
},
added_number => {
lib/Amazon/DynamoDB/Types.pm view on Meta::CPAN
(exists($_->{Exists}) || exists($_->{Value})))
};
declare ExpectedType, as Map[AttributeNameType, ExpectedValueType];
coerce ExpectedType, from HashRef, via { ExpectedType->new($_) };
declare AttributeUpdatesType, as Map[AttributeNameType, Dict[Action => StrMatch[qr/^(PUT|DELETE|ADD)$/],
Value => Optional[AttributeValueType]]];
coerce AttributeUpdatesType, from HashRef, via { AttributeUpdatesType->new($_); };
declare ItemType, as Map[AttributeNameType, AttributeValueType];
declare KeyType, as Map[AttributeNameType, AttributeValueType], where { scalar(keys %$_) > 0 && scalar(keys %$_) < 3 };
declare BatchWritePutItemType, as Dict[PutRequest => Dict[Item => ItemType]];
declare BatchWriteDeleteItemType, as Dict[DeleteRequest => Dict[Key => KeyType]];
declare BatchWriteRequestItemsType, as Map[TableNameType, ArrayRef[BatchWritePutItemType|BatchWriteDeleteItemType]], where { scalar(keys %$_) > 0 };
t/03-simple-get-put.t view on Meta::CPAN
{
my $update = $ddb->update_item(
TableName => $table_name,
Key => {
user_id => 2
},
AttributeUpdates => {
name => {
Action => 'PUT',
Value => "Rusty Conover-3",
},
favorite_color => {
Action => 'DELETE'
},
test_numbers => {
Action => 'DELETE',
Value => [500]
},
added_number => {
t/03-simple-get-put.t view on Meta::CPAN
# only update if the name of user_id 3 is Fred.
{
my $update = $ddb->update_item(
TableName => $table_name,
Key => {
user_id => 3,
},
AttributeUpdates => {
name => {
Action => 'PUT',
Value => "R2D2",
},
},
Expected => {
name => {
Value => "Fred",
},
}
);
ok(!$update->is_done, "update_item was failed");
t/03-simple-get-put.t view on Meta::CPAN
{
my $update = $ddb->update_item(
TableName => $table_name,
Key => {
user_id => 3,
},
AttributeUpdates => {
name => {
Action => 'PUT',
Value => "R2D2",
},
},
Expected => {
name => {
ComparisonOperator => 'EQ',
AttributeValueList => 'Fred',
},
}
);
t/03-simple-get-put.t view on Meta::CPAN
{
my $update = $ddb->update_item(
TableName => $table_name,
Key => {
user_id => 3,
},
AttributeUpdates => {
name => {
Action => 'PUT',
Value => "R2D2",
},
},
Expected => {
name => {
ComparisonOperator => 'IN',
AttributeValueList => ['Fred'],
},
}
);
t/03-simple-get-put.t view on Meta::CPAN
{
my $update = $ddb->update_item(
TableName => $table_name,
Key => {
user_id => 3,
},
AttributeUpdates => {
name => {
Action => 'PUT',
Value => "R2D2",
},
},
Expected => {
name => {
Value => "Rusty",
Exists => 'true',
},
email => {
Exists => 'false'
( run in 0.488 second using v1.01-cache-2.11-cpan-4e96b696675 )