Add a test for nesting .map

This commit is contained in:
Jonas Platte 2021-01-22 14:59:04 +01:00 committed by Ryan Leckey
parent 7ebd362453
commit 2b2418c6d1

View File

@ -152,6 +152,21 @@ CREATE TEMPORARY TABLE users (id INTEGER PRIMARY KEY);
Ok(())
}
#[sqlx_macros::test]
async fn it_can_nest_map() -> anyhow::Result<()> {
let mut conn = new::<Postgres>().await?;
let res = sqlx::query("SELECT 5")
.map(|row: PgRow| row.get(0))
.map(|int: i32| int.to_string())
.fetch_one(&mut conn)
.await?;
assert_eq!(res, "5");
Ok(())
}
#[cfg(feature = "json")]
#[sqlx_macros::test]
async fn it_describes_and_inserts_json_and_jsonb() -> anyhow::Result<()> {