uqa_sql/catalog/roles/dependencies/
context.rs1use crate::{
10 catalog::{
11 security::{database::DatabaseSecurity, SchemaSecurity, SequenceSecurity, TableSecurity},
12 stored_view::StoredView,
13 },
14 routines::SQLUserFunction,
15};
16use std::{collections::BTreeMap, ops::Deref, sync::Arc};
17use uqa_core::RelationIdentity;
18
19pub type RoleDependencyRead<'a, T> = Box<dyn Deref<Target = T> + 'a>;
20pub trait RoleTableSecurity {
22 fn security(&self) -> TableSecurity;
23}
24pub trait RoleTablesRead {
26 fn iter(&self) -> Box<dyn Iterator<Item = (&RelationIdentity, &dyn RoleTableSecurity)> + '_>;
27}
28pub trait RoleDependencyCatalog {
29 fn database(&self) -> RoleDependencyRead<'_, DatabaseSecurity>;
30 fn schemas(&self) -> RoleDependencyRead<'_, BTreeMap<String, SchemaSecurity>>;
31 fn tables(&self) -> Box<dyn RoleTablesRead + '_>;
32 fn views(&self) -> RoleDependencyRead<'_, BTreeMap<RelationIdentity, StoredView>>;
33 fn foreign_tables(&self) -> RoleDependencyRead<'_, BTreeMap<RelationIdentity, TableSecurity>>;
34 fn sequences(&self) -> RoleDependencyRead<'_, BTreeMap<RelationIdentity, SequenceSecurity>>;
35 fn routines(&self) -> RoleDependencyRead<'_, BTreeMap<String, Vec<Arc<SQLUserFunction>>>>;
36}