Add an item to a table. snippet-start:[dynamodb.rust.add-item]
(client: &Client, item: Item, table: &str)
| 71 | // Add an item to a table. |
| 72 | // snippet-start:[dynamodb.rust.add-item] |
| 73 | pub async fn add_item(client: &Client, item: Item, table: &str) -> Result<(), Error> { |
| 74 | let item = to_item(item)?; |
| 75 | |
| 76 | let request = client.put_item().table_name(table).set_item(Some(item)); |
| 77 | |
| 78 | tracing::info!("adding item to DynamoDB"); |
| 79 | |
| 80 | let _resp = request.send().await?; |
| 81 | |
| 82 | Ok(()) |
| 83 | } |