pub struct Relation {
pub entries: Vec<RelationEntry>,
pub tables: Vec<String>,
pub table_column_counts: Vec<usize>,
}Expand description
A relation is a collection of entries with table context.
Fields§
§entries: Vec<RelationEntry>The entries in this relation.
tables: Vec<String>Table names in this relation.
table_column_counts: Vec<usize>Column counts for each table (used for computing offsets in joined relations). The i-th element is the number of columns in the i-th table.
Implementations§
Source§impl Relation
impl Relation
Sourcepub fn new_with_column_counts(
tables: Vec<String>,
column_counts: Vec<usize>,
) -> Self
pub fn new_with_column_counts( tables: Vec<String>, column_counts: Vec<usize>, ) -> Self
Creates a new empty relation with column counts.
Sourcepub fn from_rows(rows: Vec<Rc<Row>>, tables: Vec<String>) -> Self
pub fn from_rows(rows: Vec<Rc<Row>>, tables: Vec<String>) -> Self
Creates a relation from Rc
Sourcepub fn from_rows_with_column_count(
rows: Vec<Rc<Row>>,
tables: Vec<String>,
column_count: usize,
) -> Self
pub fn from_rows_with_column_count( rows: Vec<Rc<Row>>, tables: Vec<String>, column_count: usize, ) -> Self
Creates a relation from Rc
Sourcepub fn from_rows_owned(rows: Vec<Row>, tables: Vec<String>) -> Self
pub fn from_rows_owned(rows: Vec<Row>, tables: Vec<String>) -> Self
Creates a relation from owned Rows. Uses shared tables to avoid cloning for each row.
Sourcepub fn table_column_counts(&self) -> &[usize]
pub fn table_column_counts(&self) -> &[usize]
Returns the column counts for each table.
Sourcepub fn get_table_offset(&self, table_name: &str) -> Option<usize>
pub fn get_table_offset(&self, table_name: &str) -> Option<usize>
Computes the column offset for a given table name. Returns None if the table is not found.
Sourcepub fn push(&mut self, entry: RelationEntry)
pub fn push(&mut self, entry: RelationEntry)
Adds an entry to the relation.
Sourcepub fn iter(&self) -> impl Iterator<Item = &RelationEntry>
pub fn iter(&self) -> impl Iterator<Item = &RelationEntry>
Returns an iterator over the entries.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Relation
impl RefUnwindSafe for Relation
impl !Send for Relation
impl !Sync for Relation
impl Unpin for Relation
impl UnwindSafe for Relation
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