pub struct Join<F: Field> {
pub join_type: JoinType,
pub alias: Option<String>,
pub dock_table_alias: String,
pub dock_field: F,
pub connector_field: F,
}Expand description
Represents a join statement for SQL.
All used fields must be safe to use in an SQL Query!
Will Serialize like this:
{join_type} join "{source_table}"
on "{dock_table}.{dock_field}" = "{alias||source_table}.{connector_field||dock_field}"
[as "{alias}"]Fields§
§join_type: JoinTypeWhich kind of join to perform
alias: Option<String>What name the joined table has after the join defaults to the table of the connector field.
dock_table_alias: StringThe alias name of the table docked against
dock_field: FThe field that gets compared against.
connector_field: FThe field in the soutce tablethat has to equal dock_field
This also determines which table gets joined in.
Implementations§
Source§impl<F: Field> Join<F>
impl<F: Field> Join<F>
Sourcepub fn to_sql(&self) -> String
pub fn to_sql(&self) -> String
Serializes the Join struct to SQL
Note: to_string() was intentionally not used here
as relying on that might have uninteded footgun-like
consquences in the future.
Sourcepub fn table_alias(&self) -> &str
pub fn table_alias(&self) -> &str
Returns the name the table can be accessd under in an SQL statement.
This is either the alias if set or the source_table name.
Trait Implementations§
impl<F: Eq + Field> Eq for Join<F>
impl<F: Field> StructuralPartialEq for Join<F>
Auto Trait Implementations§
impl<F> Freeze for Join<F>where
F: Freeze,
impl<F> RefUnwindSafe for Join<F>where
F: RefUnwindSafe,
impl<F> Send for Join<F>where
F: Send,
impl<F> Sync for Join<F>where
F: Sync,
impl<F> Unpin for Join<F>where
F: Unpin,
impl<F> UnwindSafe for Join<F>where
F: UnwindSafe,
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