feature/authentication service #9
1
apps/api/src/helpers.rs
Normal file
1
apps/api/src/helpers.rs
Normal file
@@ -0,0 +1 @@
|
||||
pub mod database;
|
||||
13
apps/api/src/helpers/database.rs
Normal file
13
apps/api/src/helpers/database.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
#[macro_export]
|
||||
macro_rules! with_conn {
|
||||
// Usage: with_conn!(connection, tx_option, ident, |conn|-> { ... })
|
||||
($conn:expr, $tx:expr, $ident:ident, $body:block) => {{
|
||||
if let Some(t) = $tx {
|
||||
let $ident = t;
|
||||
$body
|
||||
} else {
|
||||
let $ident = $conn;
|
||||
$body
|
||||
}
|
||||
}};
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
mod cmd;
|
||||
mod configs;
|
||||
mod errors;
|
||||
mod helpers;
|
||||
mod log;
|
||||
mod middlewares;
|
||||
mod routes;
|
||||
|
||||
Reference in New Issue
Block a user