Macro dysql::fetch_scalar

source ·
fetch_scalar!() { /* proc-macro */ }
Expand description

Fetch a scalar value from query

§Examples

Basic usage:

let conn = connect_db().await;
 
let rst = fetch_scalar!(|&conn| -> i64 {
    r#"select count (*) from test_user"#
}).unwrap();
assert_eq!(3, rst);