pub struct Relationship {
pub child: Side,
pub parent: Side,
pub cardinality: Cardinality,
}Expand description
A declared many-to-one relationship from a child table to a parent table.
Fields§
§child: SideThe many side, which is where the forward link lives.
parent: SideThe one side, which is where the key map lives.
cardinality: CardinalityWhat the build observed, or Cardinality::Unverified before it ran.
Implementations§
Source§impl Relationship
impl Relationship
Sourcepub fn declare(child: Side, parent: Side) -> Result<Self>
pub fn declare(child: Side, parent: Side) -> Result<Self>
A relationship not yet verified, which is what a declaration produces.
§Errors
If the two sides have different numbers of key columns, or if a side names a table as its own parent through the same columns. The first is a declaration that cannot be equated column by column. The second is a self relationship on identical columns, which is the identity and carries no information.
Sourcepub fn name(&self) -> String
pub fn name(&self) -> String
The name this relationship reports under in rudb_links().
Derived rather than given, because section 2.3 names a relationship by what it relates and
there is nowhere in the graph_links grammar for an author to supply a name. A derived name
is also stable across a reload, which is what lets a query log entry from yesterday still
name a relationship today.
Sourcepub fn single_column(&self) -> bool
pub fn single_column(&self) -> bool
Whether the two sides are keyed on one column each.