Skip to content

Commit

Permalink
doc: comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jacek-prisma committed Jan 7, 2025
1 parent 655db85 commit b042a29
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,22 @@ use crate::{model_extensions::AsColumn, *};
use quaint::prelude::Column;
use query_structure::ScalarField;

/// An alias referring to a table or a join on a table.
#[derive(Debug, Clone, Copy)]
pub enum Alias {
Table(usize),
Join(usize),
}

impl Alias {
/// Converts the alias to one that refers to a join on the table.
pub fn to_join_alias(self) -> Self {
match self {
Self::Table(index) | Self::Join(index) => Self::Join(index),
}
}

/// Converts the alias to one that refers to the table.
pub fn to_table_alias(self) -> Self {
match self {
Self::Table(index) | Self::Join(index) => Self::Table(index),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ impl FilterVisitor {
/// Traverses a relation filter using this rough SQL structure:
///
/// ```sql
/// (parent.id) IN (
/// EXISTS (
/// SELECT id FROM parent
/// INNER JOIN child ON (child.parent_id = parent.id)
/// WHERE <filter>
/// WHERE <filter> AND outer.id = parent.id
/// )
/// ```
/// We need this in two cases:
Expand Down Expand Up @@ -193,9 +193,9 @@ impl FilterVisitor {
/// Traverses a relation filter using this rough SQL structure:
///
/// ```sql
/// (parent.id1, parent.id2) IN (
/// EXISTS (
/// SELECT id1, id2 FROM child
/// WHERE <filter>
/// WHERE <filter> AND outer.id1 = child.id1 AND outer.id2 = child.id2
/// )
/// ```
fn visit_relation_filter_select_with_row(&mut self, filter: RelationFilter, ctx: &Context<'_>) -> Select<'static> {
Expand Down

0 comments on commit b042a29

Please sign in to comment.