[−][src]Macro sqlx::query_file_as
This is supported on
feature="macros"
only.Combines the syntaxes of query_as! and query_file!.
Enforces requirements of both macros; see them for details.
#[derive(Debug)] struct Account { id: i32, name: String } // let mut conn = <impl sqlx::Executor>; let account = sqlx::query_file_as!(Account, "examples/queries/account-by-id.sql", 1i32) .fetch_one(&mut conn) .await?; println!("{:?}", account); println!("{}: {}", account.id, account.name);