pub struct RelationRegistry { /* private fields */ }Expand description
Registry of table foreign-key relationships for auto-join inference.
Implementations§
Source§impl RelationRegistry
impl RelationRegistry
Sourcepub fn register(
&mut self,
from_table: &str,
from_col: &str,
to_table: &str,
to_col: &str,
)
pub fn register( &mut self, from_table: &str, from_col: &str, to_table: &str, to_col: &str, )
Register a foreign-key relation from schema.
§Arguments
from_table— Source (referencing) table.from_col— Foreign-key column in the source table.to_table— Target (referenced) table.to_col— Primary-key column in the target table.
Sourcepub fn get(&self, from_table: &str, to_table: &str) -> Option<(&str, &str)>
pub fn get(&self, from_table: &str, to_table: &str) -> Option<(&str, &str)>
Lookup join columns for a relation.
Returns (from_col, to_col) if the relation exists.
§Arguments
from_table— Source table name.to_table— Target table name.
Sourcepub fn referencing(&self, table: &str) -> Vec<&str>
pub fn referencing(&self, table: &str) -> Vec<&str>
Get all tables that reference this table (for reverse joins).
Sourcepub fn from_build_schema(schema: &Schema) -> Self
pub fn from_build_schema(schema: &Schema) -> Self
Load relations from a parsed build::Schema.
Trait Implementations§
Source§impl Debug for RelationRegistry
impl Debug for RelationRegistry
Source§impl Default for RelationRegistry
impl Default for RelationRegistry
Source§fn default() -> RelationRegistry
fn default() -> RelationRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for RelationRegistry
impl RefUnwindSafe for RelationRegistry
impl Send for RelationRegistry
impl Sync for RelationRegistry
impl Unpin for RelationRegistry
impl UnsafeUnpin for RelationRegistry
impl UnwindSafe for RelationRegistry
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