Skip to main content

ExpressionBuilder

Struct ExpressionBuilder 

Source
pub struct ExpressionBuilder<'a> { /* private fields */ }
Expand description

Builds the conditions of a where (ExpressionBuilder in packages/zql/src/query/expression.ts).

Implementations§

Source§

impl<'a> ExpressionBuilder<'a>

Source

pub fn cmp( &self, field: impl Into<String>, op: SimpleOperator, value: impl Into<Value>, ) -> Condition

field compares to value by op.

Source

pub fn cmp_param( &self, field: impl Into<String>, op: SimpleOperator, param: &StaticParameter, ) -> Condition

field compares to a value of the context by op.

Source

pub fn json( &self, column: impl Into<String>, path: Vec<JsonPathSegment>, ) -> JsonPathReference

A value inside the json column column, for Self::cmp_json: path is object keys and array indices, applied in order. At least one segment is needed, and an index must be at most MAX_JSON_PATH_INDEX.

Source

pub fn cmp_json( &self, reference: &JsonPathReference, op: SimpleOperator, value: impl Into<Value>, ) -> Condition

Compares the value at a JSON path with a value of the same JSON type; a value of another type never equals it. An IN list must hold values of one type.

Source

pub fn cmp_json_param( &self, reference: &JsonPathReference, op: SimpleOperator, param: &StaticParameter, ) -> Condition

The value at the JSON path compares to a value of the context by op.

Source

pub fn cmp_lit( &self, left: impl Into<Value>, op: SimpleOperator, right: impl Into<Value>, ) -> Condition

Compares two literals, neither of them a column.

Source

pub fn cmp_lit_param( &self, left: &StaticParameter, op: SimpleOperator, right: impl Into<Value>, ) -> Condition

Compares a value of the context with a literal.

Source

pub fn and(&self, conditions: Vec<Condition>) -> Condition

Rows that every condition matches.

Source

pub fn or(&self, conditions: Vec<Condition>) -> Condition

Rows that any condition matches.

Source

pub fn not(&self, condition: Condition) -> Condition

Rows that condition doesn’t match.

Source

pub fn exists( &self, relationship: &str, options: ExistsOptions, sub: impl FnOnce(AnyQuery) -> AnyQuery, ) -> Condition

Whether a related row in relationship matches sub.

Auto Trait Implementations§

§

impl<'a> !Freeze for ExpressionBuilder<'a>

§

impl<'a> !RefUnwindSafe for ExpressionBuilder<'a>

§

impl<'a> !Sync for ExpressionBuilder<'a>

§

impl<'a> Forget for ExpressionBuilder<'a>

§

impl<'a> Move for ExpressionBuilder<'a>

§

impl<'a> Send for ExpressionBuilder<'a>

§

impl<'a> Unpin for ExpressionBuilder<'a>

§

impl<'a> UnsafeUnpin for ExpressionBuilder<'a>

§

impl<'a> UnwindSafe for ExpressionBuilder<'a>

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> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.