pub struct SchemaCache {
pub tables: TablesMap,
pub relationships: RelationshipsMap,
pub routines: RoutineMap,
pub timezones: HashSet<String>,
pub pg_version: i32,
}Expand description
Cached PostgreSQL schema metadata.
Fields§
§tables: TablesMapTables and views by qualified identifier.
relationships: RelationshipsMapRelationships between tables.
routines: RoutineMapStored functions/procedures.
timezones: HashSet<String>Valid timezone names.
pg_version: i32PostgreSQL version.
Implementations§
Source§impl SchemaCache
impl SchemaCache
Sourcepub async fn load(pool: &PgPool, schemas: &[String]) -> Result<Self>
pub async fn load(pool: &PgPool, schemas: &[String]) -> Result<Self>
Load schema cache from the database.
Sourcepub fn get_table(&self, qi: &QualifiedIdentifier) -> Option<&Table>
pub fn get_table(&self, qi: &QualifiedIdentifier) -> Option<&Table>
Get a table by qualified identifier.
Sourcepub fn require_table(&self, qi: &QualifiedIdentifier) -> Result<&Table>
pub fn require_table(&self, qi: &QualifiedIdentifier) -> Result<&Table>
Get a table, returning an error if not found.
Sourcepub fn get_relationships(
&self,
qi: &QualifiedIdentifier,
schema: &str,
) -> Option<&Vec<Relationship>>
pub fn get_relationships( &self, qi: &QualifiedIdentifier, schema: &str, ) -> Option<&Vec<Relationship>>
Get relationships for a table.
Sourcepub fn get_routines(&self, qi: &QualifiedIdentifier) -> Option<&Vec<Routine>>
pub fn get_routines(&self, qi: &QualifiedIdentifier) -> Option<&Vec<Routine>>
Get a routine by qualified identifier.
Sourcepub fn is_valid_timezone(&self, tz: &str) -> bool
pub fn is_valid_timezone(&self, tz: &str) -> bool
Check if a timezone is valid.
Sourcepub fn find_relationship(
&self,
from: &QualifiedIdentifier,
to_name: &str,
schema: &str,
) -> Option<&Relationship>
pub fn find_relationship( &self, from: &QualifiedIdentifier, to_name: &str, schema: &str, ) -> Option<&Relationship>
Find a relationship between two tables by name.
Trait Implementations§
Source§impl Clone for SchemaCache
impl Clone for SchemaCache
Source§fn clone(&self) -> SchemaCache
fn clone(&self) -> SchemaCache
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SchemaCache
impl RefUnwindSafe for SchemaCache
impl Send for SchemaCache
impl Sync for SchemaCache
impl Unpin for SchemaCache
impl UnwindSafe for SchemaCache
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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