aws-sdk-rust
aws-sdk-rust copied to clipboard
[request]: impl `From` for types contained in aws_sdk_dynamodb::model::AttributeValue
A note for the community
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue, please leave a comment
Tell us about your request
- Implement
FromforAttributeValuefor common types- Blob -> AttributeValue::B
- bool -> AttributeValue::Bool
- Vec<Blob> -> AttributeValue::Bs
- Vec<AttributeValue> -> AttributeValue::L
- HashMap<String, AttributeValue>, AttributeValue::M
- all number types -> AttributeValue::N
- Vec
-> AttributeValue::Ns - String -> AttributeValue::S
- Vec<String> -> AttributeValue::SS
- (I left out AttributeValue::Null since that would conflict with AttributeValue::Bool)
- Let all methods that currently take
AttributeValueinstead takeInto<AttributeValue>
That will allow methods such as expression_attribute_values to be used like this
expression_attribute_values(":name", "some name".to_string())
instead of the current
expression_attribute_values(":name", AttributeValue::S("some name".to_string()))
Tell us about the problem you're trying to solve.
Make constructing AttributeValues more ergonomic.
Are you currently working around this issue?
Converting to AttributeValue manually.
Additional context
No response
this is a great idea! It's unfortunate that we can't do it for all unions (because determining the conflicts and allowing for backwards compatibility doesn't work :-/)
I think we probably won't accept Into<AttributeValue> on methods, at least not currently because it confounds IDE type hinting so badly. However, we could include an auto From impl where we impl From<&str> which would allow expression_attribute_values(":name":, "some name".into())
Probably the best way to tackle this is as a customization on AttributeValue specifically