Amazon-DynamoDB
view release on metacpan or search on metacpan
lib/Amazon/DynamoDB/Types.pm view on Meta::CPAN
return defined($$v);
} elsif ($ref_type eq 'ARRAY') {
return scalar(@$v) > 0;
}
} else {
return $v =~ /\S/;
}
return 0;
};
declare AttributesToGetType, as ArrayRef[AttributeNameType], where { scalar(@$_) >= 1 };
declare KeySchemaType, as ArrayRef[AttributeNameType], where { scalar(@$_) <= 2 && scalar(@$_) > 0 };
declare GlobalSecondaryIndexType, as Dict[IndexName => TableNameType,
ProvisionedThroughput => Optional[Dict[ReadCapacityUnits => Optional[Int],
WriteCapacityUnits => Optional[Int]
]
],
KeySchema => KeySchemaType,
Projection => Optional[Dict[ProjectionType => StrMatch[qr/^(KEYS_ONLY|INCLUDE|ALL)$/],
NonKeyAttributes => Optional[ArrayRef[AttributeNameType]]]],
];
coerce GlobalSecondaryIndexType, from HashRef, via {
GlobalSecondaryIndexType->new($_);
};
declare LocalSecondaryIndexType, as Dict[IndexName => TableNameType,
KeySchema => KeySchemaType,
Projection => Optional[Dict[ProjectionType => StrMatch[qr/^(KEYS_ONLY|INCLUDE|ALL)$/],
NonKeyAttributes => Optional[ArrayRef[AttributeNameType]]]]
];
coerce LocalSecondaryIndexType, from HashRef, via {
LocalSecondaryIndexType->new($_);
};
declare TableStatusType, as StrMatch[qr/^(CREATING|UPDATING|DELETING|ACTIVE)$/];
coerce TableStatusType, from Str, via { TableStatusType->new($_) };
declare ExpectedValueType, as Dict[AttributeValueList => Optional[AttributeValueType],
ComparisonOperator => Optional[ComparisonOperatorType],
Exists => Optional[StringBooleanType],
Value => Optional[AttributeValueType],
], where { scalar(keys %$_) > 0 &&
# don't allow both forms of expected/comparision operator
# to be used at the same time.
((exists($_->{AttributeValueList}) || exists($_->{ComparisonOperator}))
xor
(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 };
declare BatchGetItemsType, as Map[TableNameType, Dict[AttributesToGet => Optional[AttributesToGetType],
ConsistentRead => Optional[StringBooleanType],
Keys => ArrayRef[KeyType]]
], where { scalar(keys %$_) > 0 };
declare KeyConditionsType, as Map[AttributeNameType, Dict[AttributeValueList => AttributeValueType,
ComparisonOperator => StrMatch[qr/^(EQ|LE|LT|GE|GT|BEGINS_WITH|BETWEEN)$/]
]];
declare QueryFilterType, as Map[AttributeNameType, Dict[AttributeValueList => Optional[AttributeValueType],
ComparisonOperator => ComparisonOperatorType
]];
declare ScanFilterType, as Map[AttributeNameType, Dict[AttributeValueList => Optional[AttributeValueType],
ComparisonOperator => ComparisonOperatorType
]];
declare ExpressionAttributeValuesType, as Map[StrMatch[qr/^:[a-zA-Z][a-z0-9A-Z_]*$/], AttributeValueType];
coerce ExpressionAttributeValuesType, from HashRef, via { ExpressionAttributeValuesType->new($_) };
declare ExpressionAttributeNamesType, as Map[StrMatch[qr/^\#[a-zA-Z][a-z0-9A-Z_]*$/], Str];
coerce ExpressionAttributeNamesType, from HashRef, via { ExpressionAttributeNamesType->new($_) };
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Amazon::DynamoDB::Types
=head1 VERSION
version 0.35
=head1 AUTHORS
=over 4
=item *
Rusty Conover <rusty@luckydinosaur.com>
( run in 1.032 second using v1.01-cache-2.11-cpan-437f7b0c052 )