Skip to content

Commit 75cae05

Browse files
[examples] Sync SDK examples from awsdocs/aws-doc-sdk-examples
Includes commit(s): 8ea9d08a39637e73b2cd2ef03e82a0669d24d6d8 Co-authored-by: David Souther <[email protected]>
1 parent 107337c commit 75cae05

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

examples/examples/s3/src/bin/select-object-content.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
#![allow(clippy::result_large_err)]
55

6-
use anyhow::bail;
76
use aws_config::meta::region::RegionProviderChain;
87
use aws_sdk_s3::types::{
98
CompressionType, CsvInput, ExpressionType, FileHeaderInfo, InputSerialization, JsonOutput,
@@ -44,12 +43,12 @@ struct Opt {
4443

4544
#[derive(Debug, Deserialize)]
4645
#[serde(rename_all = "PascalCase")]
47-
struct Record {
48-
name: String,
49-
phone_number: String,
50-
city: String,
51-
occupation: String,
52-
description: String,
46+
pub struct Record {
47+
pub name: String,
48+
pub phone_number: String,
49+
pub city: String,
50+
pub occupation: String,
51+
pub description: String,
5352
}
5453

5554
fn is_valid_json(data: impl AsRef<str>) -> bool {
@@ -65,7 +64,7 @@ async fn get_content(
6564
name: &str,
6665
) -> Result<(), anyhow::Error> {
6766
// To escape a single quote, use two single quotes.
68-
let name = name.replace("'", "''");
67+
let name = name.replace('\'', "''");
6968
let person: String = format!("SELECT * FROM s3object s where s.Name like '{name}%'");
7069
tracing::info!(query = %person);
7170

@@ -131,11 +130,11 @@ async fn get_content(
131130
/// Parse a new line &str, potentially using content from the previous line
132131
fn parse_line_buffered(buf: &mut String, line: &str) -> Result<Option<Record>, anyhow::Error> {
133132
if buf.is_empty() && is_valid_json(line) {
134-
return Ok(Some(serde_json::from_str(line)?));
133+
Ok(Some(serde_json::from_str(line)?))
135134
} else {
136135
buf.push_str(line);
137136
if is_valid_json(&buf) {
138-
let result = serde_json::from_str(&buf);
137+
let result = serde_json::from_str(buf);
139138
buf.clear();
140139
Ok(Some(result?))
141140
} else {

versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
smithy_rs_revision = '4bdd9dab74185c82e92a47efe9bbbe5acd101e13'
2-
aws_doc_sdk_examples_revision = 'dbef793bffc03888015c55ef3a0218422b196f1d'
2+
aws_doc_sdk_examples_revision = '8ea9d08a39637e73b2cd2ef03e82a0669d24d6d8'
33

44
[manual_interventions]
55
crates_to_remove = []

0 commit comments

Comments
 (0)