use crate::{
catalog::{
security::{database::DatabaseSecurity, SchemaSecurity, SequenceSecurity, TableSecurity},
stored_view::StoredView,
},
routines::SQLUserFunction,
};
use std::{collections::BTreeMap, ops::Deref, sync::Arc};
use uqa_core::RelationIdentity;
pub type RoleDependencyRead<'a, T> = Box<dyn Deref<Target = T> + 'a>;
pub trait RoleTableSecurity {
fn security(&self) -> TableSecurity;
}
pub trait RoleTablesRead {
fn iter(&self) -> Box<dyn Iterator<Item = (&RelationIdentity, &dyn RoleTableSecurity)> + '_>;
}
pub trait RoleDependencyCatalog {
fn database(&self) -> RoleDependencyRead<'_, DatabaseSecurity>;
fn schemas(&self) -> RoleDependencyRead<'_, BTreeMap<String, SchemaSecurity>>;
fn tables(&self) -> Box<dyn RoleTablesRead + '_>;
fn views(&self) -> RoleDependencyRead<'_, BTreeMap<RelationIdentity, StoredView>>;
fn foreign_tables(&self) -> RoleDependencyRead<'_, BTreeMap<RelationIdentity, TableSecurity>>;
fn sequences(&self) -> RoleDependencyRead<'_, BTreeMap<RelationIdentity, SequenceSecurity>>;
fn routines(&self) -> RoleDependencyRead<'_, BTreeMap<String, Vec<Arc<SQLUserFunction>>>>;
}