feature/authentication service #9
@@ -1,12 +1,12 @@
|
|||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! with_conn {
|
macro_rules! with_conn {
|
||||||
// Usage: with_conn!(connection, tx_option, ident, |conn|-> { ... })
|
// Usage: with_conn!(&connection, tx_option, ident, |conn|-> { ... })
|
||||||
($conn:expr, $tx:expr, $ident:ident, $body:block) => {{
|
($conn:expr, $tx:expr, $ident:ident, $body:block) => {{
|
||||||
if let Some(t) = $tx {
|
if let Some(t) = &$tx {
|
||||||
let $ident = t;
|
let $ident = t;
|
||||||
$body
|
$body
|
||||||
} else {
|
} else {
|
||||||
let $ident = $conn;
|
let $ident = &$conn;
|
||||||
$body
|
$body
|
||||||
}
|
}
|
||||||
}};
|
}};
|
||||||
|
|||||||
Reference in New Issue
Block a user