elif_orm/query/
joins.rs

1//! Query Builder JOIN operations
2
3use super::builder::QueryBuilder;
4use super::types::*;
5
6impl<M> QueryBuilder<M> {
7    /// Add INNER JOIN to the query
8    pub fn join(mut self, table: &str, left_col: &str, right_col: &str) -> Self {
9        self.joins.push(JoinClause {
10            join_type: JoinType::Inner,
11            table: table.to_string(),
12            on_conditions: vec![(left_col.to_string(), right_col.to_string())],
13        });
14        self
15    }
16
17    /// Add LEFT JOIN to the query
18    pub fn left_join(mut self, table: &str, left_col: &str, right_col: &str) -> Self {
19        self.joins.push(JoinClause {
20            join_type: JoinType::Left,
21            table: table.to_string(),
22            on_conditions: vec![(left_col.to_string(), right_col.to_string())],
23        });
24        self
25    }
26
27    /// Add RIGHT JOIN to the query
28    pub fn right_join(mut self, table: &str, left_col: &str, right_col: &str) -> Self {
29        self.joins.push(JoinClause {
30            join_type: JoinType::Right,
31            table: table.to_string(),
32            on_conditions: vec![(left_col.to_string(), right_col.to_string())],
33        });
34        self
35    }
36}