Rindle docs and package mapSkip to main content

Ast

Struct Ast 

Source
pub struct Ast {
Show 14 fields pub schema: Option<Box<str>>, pub table: Box<str>, pub alias: Option<Box<str>>, pub select: Option<Vec<Box<str>>>, pub where: Option<Condition>, pub related: Vec<CorrelatedSubquery>, pub start: Option<Bound>, pub limit: Option<u32>, pub one: bool, pub aggregate: Option<Aggregate>, pub aggregate_precomputed: bool, pub group_by: Vec<Box<str>>, pub having: Option<Condition>, pub order_by: Vec<OrderPart>,
}
Expand description

The query AST (Ast, ast.ts:217-243). table is the only required field; every other wire field is optional. Default enables struct-update syntax for hand-written test expectations. Deserializes from the JS wire JSON (camelCase keys; absent ⇒ None/empty).

Fields§

§schema: Option<Box<str>>

Postgres schema namespace — opaque pass-through (ast.ts:218).

§table: Box<str>

Source table name. The only required field.

§alias: Option<Box<str>>

Subquery alias (the relationship name, when this is a sub/exists child).

§select: Option<Vec<Box<str>>>

Projection. Noneselect all columns; Some(cols) ⇒ just cols. Sanctioned non-wire extension (see module docs); serialized only when set.

§where: Option<Condition>

Filter tree.

§related: Vec<CorrelatedSubquery>

Child subqueries (materialized relationships). Empty ⇒ none.

§start: Option<Bound>

Paging lower bound.

§limit: Option<u32>

Row limit.

§one: bool

.one() — return a single row: the result is presented as one object (or null/absent) instead of an array. Query intent recorded on the AST; the engine stays plural internally and the single-element unwrap happens at the result boundary (the builder lowers one onto the view Schema’s singular flag). A .one() query also sets limit = 1. On a related subquery, one makes that relationship singular.

§aggregate: Option<Aggregate>

Aggregate this (sub)query’s rows instead of materializing them (REDUCE-DESIGN.md). None ⇒ ordinary row output; Some on a related subquery ⇒ a relationship aggregate the builder lowers to a reduce + a scalar-projected singular relationship (§9). Absent on the wire ⇒ None.

§aggregate_precomputed: bool

The aggregate is precomputed — its (group_key…, value) rows are supplied as a (synthetic) source table rather than reduced from child rows. Set by the normalized client’s AST rewrite (AGGREGATE-SYNC-DESIGN.md §3.3): the server ships the reduce’s output as a base table, and the client reads it with a plain singular join + the same scalar projection — not a reduce, which would recount the already-aggregated rows. Only meaningful alongside aggregate; absent on the wire ⇒ false (the ordinary reduce-backed relationship aggregate).

§group_by: Vec<Box<str>>

Top-level GROUP BY columns (names, not ColIds), meaningful only alongside a root aggregate (REDUCE-DESIGN.md §8). Empty + aggregate set produces one global aggregate row; non-empty produces one [group…, aggregate] row per distinct value-tuple. The builder lowers this to an eager grouped reduce feeding the View. Distinct from a relationship aggregate’s grouping, which is implicit (the correlation child key). Absent on the wire ⇒ empty.

§having: Option<Condition>

HAVING — a filter over the post-aggregation rows of a root aggregate (REDUCE-DESIGN.md §4: a HAVING filter sits directly above the reduce). The condition addresses the aggregate’s output columns — the group_by columns and the synthetic count, sum, or avg column — not base-table columns. The builder lowers it to a Filter sub-graph above the reduce (whereas where filters rows below it); the Filter edit-split turns a group crossing the predicate threshold into an Add/Remove, so it is maintained incrementally for free. Absent ⇒ None.

§order_by: Vec<OrderPart>

Sort spec (names, not ColIds). Empty ⇒ none. Wire key orderBy.

Implementations§

Source§

impl Ast

Source

pub fn new(table: &str) -> Ast

A bare query over table with every other field absent. Equivalent to Ast { table: table.into(), ..Default::default() }.

Trait Implementations§

Source§

impl Clone for Ast

Source§

fn clone(&self) -> Ast

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Ast

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Ast

Source§

fn default() -> Ast

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Ast

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Ast

Source§

fn eq(&self, other: &Ast) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Ast

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Ast

Auto Trait Implementations§

§

impl Freeze for Ast

§

impl RefUnwindSafe for Ast

§

impl Send for Ast

§

impl Sync for Ast

§

impl Unpin for Ast

§

impl UnsafeUnpin for Ast

§

impl UnwindSafe for Ast

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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,