mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-12-28 03:33:37 +00:00
Run cargo fmt
This commit is contained in:
parent
9186400668
commit
56a82346f2
@ -52,4 +52,4 @@ async fn register(mut req: Request<Pool<Postgres>>) -> Response {
|
||||
Response::new(200)
|
||||
.body_json(&RegisterResponseBody { id: user_id })
|
||||
.unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,6 +36,9 @@ impl Encode<MySql> for String {
|
||||
|
||||
impl Decode<MySql> for String {
|
||||
fn decode(mut buf: &[u8]) -> Result<Self, DecodeError> {
|
||||
Ok(buf.get_str_lenenc::<LittleEndian>()?.unwrap_or_default().to_owned())
|
||||
Ok(buf
|
||||
.get_str_lenenc::<LittleEndian>()?
|
||||
.unwrap_or_default()
|
||||
.to_owned())
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ macro_rules! test {
|
||||
.await?;
|
||||
|
||||
assert_eq!(row.get::<i32, _>(0), 1);
|
||||
|
||||
|
||||
let value = row.get::<$ty, _>("_1");
|
||||
|
||||
assert!($value == value);
|
||||
|
||||
@ -37,7 +37,10 @@ CREATE TEMPORARY TABLE users (id INTEGER PRIMARY KEY)
|
||||
|
||||
let sum: i32 = sqlx::query("SELECT id FROM users")
|
||||
.fetch(&mut conn)
|
||||
.try_fold(0_i32, |acc, x| async move { Ok(acc + x.get::<i32, _>("id")) })
|
||||
.try_fold(
|
||||
0_i32,
|
||||
|acc, x| async move { Ok(acc + x.get::<i32, _>("id")) },
|
||||
)
|
||||
.await?;
|
||||
|
||||
assert_eq!(sum, 55);
|
||||
|
||||
@ -61,7 +61,10 @@ CREATE TEMPORARY TABLE users (id INTEGER PRIMARY KEY);
|
||||
|
||||
let sum: i32 = sqlx::query("SELECT id FROM users")
|
||||
.fetch(&mut conn)
|
||||
.try_fold(0_i32, |acc, x| async move { Ok(acc + x.get::<i32, _>("id")) })
|
||||
.try_fold(
|
||||
0_i32,
|
||||
|acc, x| async move { Ok(acc + x.get::<i32, _>("id")) },
|
||||
)
|
||||
.await?;
|
||||
|
||||
assert_eq!(sum, 55);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user