mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-04-09 03:36:01 +00:00
Run cargo fmt
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user