pub trait Reference: Send + Sync {
// Required methods
fn columns(&self, source_id: &str, target_id: &str) -> (String, String);
fn build_target(&self, data_source: &dyn Any) -> Box<dyn Any>;
fn resolve_as_any(&self, source_table: &dyn Any) -> Result<AnyTable>;
fn target_type_name(&self) -> &'static str;
// Provided method
fn is_foreign(&self) -> bool { ... }
}Expand description
Describes a relationship between two tables.
Required Methods§
Sourcefn columns(&self, source_id: &str, target_id: &str) -> (String, String)
fn columns(&self, source_id: &str, target_id: &str) -> (String, String)
Given source and target id field names, return (source_column, target_column).
Sourcefn build_target(&self, data_source: &dyn Any) -> Box<dyn Any>
fn build_target(&self, data_source: &dyn Any) -> Box<dyn Any>
Produce a fresh target table (no conditions applied).
Sourcefn resolve_as_any(&self, source_table: &dyn Any) -> Result<AnyTable>
fn resolve_as_any(&self, source_table: &dyn Any) -> Result<AnyTable>
Resolve this reference and return an AnyTable.
For same-backend: builds target, applies condition, wraps in AnyTable. For foreign: returns the AnyTable from the user’s closure.
Sourcefn target_type_name(&self) -> &'static str
fn target_type_name(&self) -> &'static str
Type name of the target table (for error messages).
Provided Methods§
Sourcefn is_foreign(&self) -> bool
fn is_foreign(&self) -> bool
Whether this is a cross-persistence reference.