Skip to main content

ignis_db/dsl/
join.rs

1//! Join system for building type-safe database queries
2
3use crate::dsl::Column;
4
5/// Join condition between two tables
6#[derive(Debug, Clone)]
7pub struct On<L, R> {
8    pub left: Column<L>,
9    pub right: Column<R>,
10}
11
12/// Extension trait for columns to create join conditions
13pub trait ColumnExt<T> {
14    fn eq_column<U>(self, other: Column<U>) -> On<T, U>;
15}
16
17impl<T> ColumnExt<T> for Column<T> {
18    fn eq_column<U>(self, other: Column<U>) -> On<T, U> {
19        On {
20            left: self,
21            right: other,
22        }
23    }
24}