pub struct Catalog {Show 20 fields
pub scope: CatalogScope,
pub schemas: Vec<Schema>,
pub tables: Vec<Table>,
pub views: Vec<View>,
pub types: Vec<CustomType>,
pub domains: Vec<Domain>,
pub collations: Vec<Collation>,
pub functions: Vec<Function>,
pub aggregates: Vec<Aggregate>,
pub operators: Vec<Operator>,
pub casts: Vec<Cast>,
pub sequences: Vec<Sequence>,
pub indexes: Vec<Index>,
pub constraints: Vec<Constraint>,
pub triggers: Vec<Trigger>,
pub policies: Vec<Policy>,
pub extensions: Vec<Extension>,
pub grants: Vec<Grant>,
pub forward_deps: BTreeMap<DbObjectId, Vec<DbObjectId>>,
pub reverse_deps: BTreeMap<DbObjectId, Vec<DbObjectId>>,
}Fields§
§scope: CatalogScopeWhich world this catalog describes. Set by whatever produced it; see
CatalogScope.
schemas: Vec<Schema>§tables: Vec<Table>§views: Vec<View>§types: Vec<CustomType>§domains: Vec<Domain>§collations: Vec<Collation>§functions: Vec<Function>§aggregates: Vec<Aggregate>§operators: Vec<Operator>§casts: Vec<Cast>§sequences: Vec<Sequence>§indexes: Vec<Index>§constraints: Vec<Constraint>§triggers: Vec<Trigger>§policies: Vec<Policy>§extensions: Vec<Extension>§grants: Vec<Grant>§forward_deps: BTreeMap<DbObjectId, Vec<DbObjectId>>§reverse_deps: BTreeMap<DbObjectId, Vec<DbObjectId>>Implementations§
Source§impl Catalog
impl Catalog
Sourcepub async fn load_managed(pool: &PgPool, filter: &ObjectFilter) -> Result<Self>
pub async fn load_managed(pool: &PgPool, filter: &ObjectFilter) -> Result<Self>
Load only the objects pgmt manages: the physical catalog scoped by the objects config. This is what diff/render/validate consumers should use — comparing or rendering an unfiltered catalog leaks image-provided substrate (the shadow branch legitimately contains it).
Sourcepub async fn load_unfiltered(pool: &PgPool) -> Result<Self>
pub async fn load_unfiltered(pool: &PgPool) -> Result<Self>
Load the raw physical catalog, including objects outside pgmt’s managed universe. Only for callers that genuinely need the physical world (substrate detection, init import before scoping is decided) or that provably filter downstream.
Sourcepub async fn load_with_file_dependencies(
pool: &PgPool,
file_augmentation: Option<&FileDependencyAugmentation>,
) -> Result<Self>
pub async fn load_with_file_dependencies( pool: &PgPool, file_augmentation: Option<&FileDependencyAugmentation>, ) -> Result<Self>
Load catalog with optional file-based dependency augmentation
Sourcepub fn with_file_dependencies_augmented(
self,
augmentation: FileDependencyAugmentation,
) -> Self
pub fn with_file_dependencies_augmented( self, augmentation: FileDependencyAugmentation, ) -> Self
Create a new catalog with file-based dependencies augmented
pub fn find_view(&self, schema: &str, name: &str) -> Option<&View>
pub fn find_table(&self, schema: &str, name: &str) -> Option<&Table>
pub fn find_policy( &self, schema: &str, table: &str, name: &str, ) -> Option<&Policy>
pub fn find_constraint( &self, schema: &str, table: &str, name: &str, ) -> Option<&Constraint>
pub fn find_function( &self, schema: &str, name: &str, arguments: &str, ) -> Option<&Function>
Sourcepub fn find_function_by_signature(
&self,
reference: &Function,
) -> Option<&Function>
pub fn find_function_by_signature( &self, reference: &Function, ) -> Option<&Function>
Find a function by signature (schema, name, and parameter types).
Unlike find_function, this ignores parameter names and only matches on types.
This is needed because PostgreSQL considers functions with the same parameter
types but different parameter names to be the same function.
pub fn find_custom_type(&self, schema: &str, name: &str) -> Option<&CustomType>
pub fn find_trigger( &self, schema: &str, table: &str, name: &str, ) -> Option<&Trigger>
pub fn find_index(&self, schema: &str, name: &str) -> Option<&Index>
pub fn find_domain(&self, schema: &str, name: &str) -> Option<&Domain>
pub fn find_collation(&self, schema: &str, name: &str) -> Option<&Collation>
pub fn find_sequence(&self, schema: &str, name: &str) -> Option<&Sequence>
pub fn find_aggregate( &self, schema: &str, name: &str, arguments: &str, ) -> Option<&Aggregate>
pub fn find_operator( &self, schema: &str, name: &str, arguments: &str, ) -> Option<&Operator>
pub fn find_cast(&self, source: &str, target: &str) -> Option<&Cast>
Sourcepub fn attached_objects(&self) -> Vec<&dyn Attached>
pub fn attached_objects(&self) -> Vec<&dyn Attached>
Every object that carries attached state (comments). Enumerated in ONE
place via an exhaustive destructure: adding a field to Catalog fails to
compile here until you decide whether the new object type is Attached.
Sourcepub fn synthesize_drop_create(
&self,
id: &DbObjectId,
new_catalog: &Catalog,
) -> Option<Vec<MigrationStep>>
pub fn synthesize_drop_create( &self, id: &DbObjectId, new_catalog: &Catalog, ) -> Option<Vec<MigrationStep>>
Synthesize DROP + CREATE steps for cascading a dependent object.
Returns None if the object type doesn’t support cascading or doesn’t
exist in both catalogs. Only the structural DROP/CREATE (and comments) are
emitted here — the object’s ACL is reapplied centrally for every recreated
object by crate::diff::cascade::reapply_acl_for_recreated_objects, since
a DROP discards all privileges regardless of what triggered the recreate.
Sourcepub fn contains_id(&self, id: &DbObjectId) -> bool
pub fn contains_id(&self, id: &DbObjectId) -> bool
Check if the catalog contains an object with the given ID
Sourcepub fn object_ids(&self) -> HashSet<DbObjectId>
pub fn object_ids(&self) -> HashSet<DbObjectId>
The identity of every object the catalog stores.
Self::contains_id answers one containment question by scanning the
matching vector, so a caller asking it once per element of another
collection is quadratic. Such a caller builds this set once and asks
Self::id_present_in instead.
Sub-object ids (comments, columns) are NOT members: they have no stored
object of their own and resolve through their parent, which is
id_present_in’s job.
Sourcepub fn id_present_in(ids: &HashSet<DbObjectId>, id: &DbObjectId) -> bool
pub fn id_present_in(ids: &HashSet<DbObjectId>, id: &DbObjectId) -> bool
Self::contains_id’s verdict, answered against a set from
Self::object_ids.
The two MUST agree for every id — sub-object resolution is spelled out
in both places (a comment is present iff its target is; a column iff its
table is), and test_id_present_in_agrees_with_contains_id pins that.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Catalog
impl RefUnwindSafe for Catalog
impl Send for Catalog
impl Sync for Catalog
impl Unpin for Catalog
impl UnsafeUnpin for Catalog
impl UnwindSafe for Catalog
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more