Skip to main content

HavingExpr

Enum HavingExpr 

Source
pub enum HavingExpr {
    Compare {
        agg: AggKind,
        col: String,
        op: CompareOp,
        value: DbValue,
    },
    And(Box<HavingExpr>, Box<HavingExpr>),
    Or(Box<HavingExpr>, Box<HavingExpr>),
    Not(Box<HavingExpr>),
    CompareAgg {
        left_agg: AggKind,
        left_col: String,
        op: CompareOp,
        right_agg: AggKind,
        right_col: String,
    },
}
Expand description

AST node for HAVING expressions.

Supports boolean combinations (AND/OR/NOT) and aggregate-versus-aggregate comparisons in addition to the basic agg(col) op value form. Generated by linq!(having ...) (Form B) expansion and compiled to SQL by to_sql.

Variants§

§

Compare

agg(col) op value — basic comparison against a literal.

Fields

§value: DbValue
§

And(Box<HavingExpr>, Box<HavingExpr>)

expr AND expr.

§

Or(Box<HavingExpr>, Box<HavingExpr>)

expr OR expr.

§

Not(Box<HavingExpr>)

NOT expr.

§

CompareAgg

agg(col1) op agg(col2) — aggregate-vs-aggregate comparison (no bound parameter).

Fields

§left_agg: AggKind
§left_col: String
§right_agg: AggKind
§right_col: String

Implementations§

Source§

impl HavingExpr

Source

pub fn to_sql(&self, gen: &dyn ISqlGenerator, param_idx: &mut usize) -> String

Recursively compiles the expression into a SQL fragment using the provider-specific placeholder syntax (? for SQLite/MySQL, $N for PostgreSQL).

param_idx is advanced past each bound parameter in left-to-right order, matching the order produced by HavingExpr::collect_params. This ensures PostgreSQL’s 1-indexed $N placeholders stay contiguous with the WHERE clause’s placeholders.

Source

pub fn collect_params(&self) -> Vec<DbValue>

Collects bound parameter values in the same left-to-right order that HavingExpr::to_sql emits placeholders. Used to populate the query parameter vector at registration time so that compile_sql returns params matching the placeholder order.

Trait Implementations§

Source§

impl Clone for HavingExpr

Source§

fn clone(&self) -> HavingExpr

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HavingExpr

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.