sqlx_utils/utils/
mod.rs

1#[macro_export]
2macro_rules! mod_def {
3    {$($vis:vis mod $ident:ident $(;)?)+} => {
4        $($vis mod $ident;
5        #[allow(unused_imports)]
6        $vis use $ident::*;)+
7    };
8
9    {!export $($vis:vis mod $ident:ident $(;)?)+} => {
10        $($vis mod $ident;
11        #[allow(unused_imports)]
12        pub use $ident::*;)+
13    };
14}
15
16mod_def! {
17    pub mod batch;
18}
19
20macro_rules! tracing_debug_log {
21    {[$(skip($($ident:ident),*) $(,)? )? $($parent:expr,)? $($name:literal,)?] $($tt:tt)*} => {
22        #[cfg_attr(feature = "log_err", tracing::instrument($(skip($($ident),*),)?level = "debug", $(parent = &$parent,)? $(name = $name,)? err))]
23        #[cfg_attr(not(feature = "log_err"), tracing::instrument($(skip($($ident),*),)?level = "debug", $(parent = &$parent,)? $(name = $name,)?))]
24        $($tt)*
25    };
26
27    {[skip_all, $($parent:expr,)? $($name:literal,)?] $($tt:tt)*} => {
28        #[cfg_attr(feature = "log_err", tracing::instrument(skip_all, level = "debug", $(parent = &$parent,)? $(name = $name,)? err))]
29        #[cfg_attr(not(feature = "log_err"), tracing::instrument(skip_all, level = "debug", $(parent = &$parent,)? $(name = $name,)?))]
30        $($tt)*
31    };
32}
33pub(crate) use tracing_debug_log;