Struct RelDef
pub struct RelDef {
pub name: Box<str>,
pub child: Option<Box<Schema>>,
pub project: Option<ScalarProjection>,
}Expand description
A declared outgoing relationship on a table Schema (slot = index in
Schema::relationships). Carries the public name the View surfaces
(09) and, when known, the target Schema the relationship points at —
the hierarchical SourceSchema the production ArrayView (09) navigates to
sort child entries. child is None for a join-only RelDef (name
resolution alone — the join already holds the child schema separately); the
View requires Some.
Fields§
§name: Box<str>Relationship name. Owned (Box<str>) so a runtime-supplied schema (the JS
wasm boundary, WS01.3) can construct it — column/relationship names are not
'static when they arrive from JavaScript. The constructors still accept
&str, so &'static str literals at the existing call sites coerce in.
child: Option<Box<Schema>>The relationship’s target schema (the child level). None for join-only
uses that need name→slot resolution but never feed a View.
project: Option<ScalarProjection>When Some, this is a scalar-projected relationship aggregate
(REDUCE-DESIGN.md §9): the presentation boundary unwraps the one-row child
into a scalar field (see ScalarProjection). None for an ordinary
(plural or .one() object) relationship.
Implementations§
§impl RelDef
impl RelDef
pub fn new(name: &str) -> RelDef
pub fn new(name: &str) -> RelDef
A join-only relationship: just a name (no child schema). Used wherever a
parent schema declares a relationship purely so a join can resolve its
rel_name to a RelId slot (Schema::rel_slot).
A View-facing relationship carrying its target (child) schema.
pub fn project_scalar(self, col: usize, identity: OwnedValue) -> RelDef
pub fn project_scalar(self, col: usize, identity: OwnedValue) -> RelDef
Mark this relationship as a scalar-projected aggregate
(REDUCE-DESIGN.md §9): the presentation boundary unwraps the one-row child,
surfacing child column col as a scalar field (with identity substituted
when the relationship is empty). Builder over RelDef::related — the child
schema (the synthetic aggregate row) must already be attached.