awslabs / awslabs/aws-sdk-rust

[request]: impl `From` for types contained in aws_sdk_dynamodb::model::AttributeValue

Open
#482 1 comment 12 reactions 0 assignees View on GitHub
feature-request high-level-library p2
Dominant language
Rust
Stars
3.3k
Forks
290
Avg merge
1d 12h
Merged PRs (30d)
3

Description

### A note for the community

### Community Note
* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) 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 `From` for `AttributeValue` for common types
- Blob -> AttributeValue::B
- bool -> AttributeValue::Bool
- Vec -> AttributeValue::Bs
- Vec -> AttributeValue::L
- HashMap, AttributeValue::M
- all number types -> AttributeValue::N
- Vec -> AttributeValue::Ns
- String -> AttributeValue::S
- Vec -> AttributeValue::SS
- (I left out AttributeValue::Null since that would conflict with AttributeValue::Bool)
- Let all methods that currently take `AttributeValue` instead take `Into`

That will allow methods such as [expression_attribute_values](https://docs.rs/aws-sdk-dynamodb/latest/aws_sdk_dynamodb/client/fluent_builders/struct.Query.html#method.expression_attribute_values) to be used like this

```rust
expression_attribute_values(":name", "some name".to_string())
```
instead of the current

```rust
expression_attribute_values(":name", AttributeValue::S("some name".to_string()))
```

### Tell us about the problem you're trying to solve.

Make constructing `AttributeValue`s more ergonomic.

### Are you currently working around this issue?

Converting to `AttributeValue` manually.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with aws_sdk_dynamodb::model::AttributeValue and the Query fluent builder's expression_attribute_values entry point. Implement the listed common-type conversions and update methods that currently take AttributeValue to accept Into, so callers can pass values such as a String directly.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, rust
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.