mirror of
https://github.com/launchbadge/sqlx
synced 2024-11-10 06:24:16 +00:00
concat test
This commit is contained in:
parent
ee106286a0
commit
03fcfc8562
1 changed files with 21 additions and 0 deletions
|
@ -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…
Reference in a new issue