mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-09-29 22:12:04 +00:00
concat test
This commit is contained in:
parent
ee106286a0
commit
03fcfc8562
@ -16,6 +16,27 @@ async fn macro_select() -> anyhow::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
macro_rules! gen_macro_select_concats {
|
||||
($param:literal) => {
|
||||
#[sqlx_macros::test]
|
||||
async fn macro_select_concat_single() -> anyhow::Result<()> {
|
||||
let mut conn = new::<Sqlite>().await?;
|
||||
|
||||
let account = sqlx::query!("select " + $param + " from accounts where id = 1")
|
||||
.fetch_one(&mut conn)
|
||||
.await?;
|
||||
|
||||
assert_eq!(1, account.id);
|
||||
assert_eq!("Herp Derpinson", account.name);
|
||||
assert_eq!(account.is_active, Some(true));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gen_macro_select_concats!("id, name, is_active");
|
||||
|
||||
#[sqlx_macros::test]
|
||||
async fn macro_select_expression() -> anyhow::Result<()> {
|
||||
let mut conn = new::<Sqlite>().await?;
|
||||
|
Loading…
x
Reference in New Issue
Block a user