#[derive(Debug, Clone, Copy)]
pub struct UserPurgeTable {
pub table: &'static str,
pub column: &'static str,
pub predicate: Option<&'static str>,
pub owner: &'static str,
}
inventory::collect!(UserPurgeTable);
pub fn registered_user_purge_tables() -> impl Iterator<Item = &'static UserPurgeTable> {
inventory::iter::<UserPurgeTable>.into_iter()
}
#[derive(Debug, Clone, Copy)]
pub struct OrphanSweep {
pub table: &'static str,
pub key: &'static str,
pub referenced_by: &'static str,
pub via: &'static str,
pub user_column: &'static str,
pub owner: &'static str,
}
inventory::collect!(OrphanSweep);
pub fn registered_orphan_sweeps() -> impl Iterator<Item = &'static OrphanSweep> {
inventory::iter::<OrphanSweep>.into_iter()
}
#[doc(hidden)]
#[macro_export]
macro_rules! __user_purge_predicate {
() => {
::core::option::Option::None
};
($predicate:literal) => {
::core::option::Option::Some($predicate)
};
}
#[macro_export]
macro_rules! user_purge_tables {
($owner:literal, [ $( ($table:literal, $column:literal $(, $predicate:literal)?) ),* $(,)? ]) => {
$(
::inventory::submit! {
$crate::purge::UserPurgeTable {
table: $table,
column: $column,
predicate: $crate::__user_purge_predicate!($($predicate)?),
owner: $owner,
}
}
)*
};
}
#[macro_export]
macro_rules! orphan_sweeps {
($owner:literal, [ $( { $($field:ident : $value:literal),* $(,)? } ),* $(,)? ]) => {
$(
::inventory::submit! {
$crate::purge::OrphanSweep {
$($field: $value,)*
owner: $owner,
}
}
)*
};
}