pub struct SqlExpr { /* private fields */ }
Expand description

A SQL expression is a list of tokens that can be resolved into SQL.

Library users are advised to not build it programmatically, but to use the sql_expr! macro. This macro provides compile time safety and convenience.

However it’s also possible to build it programmatically:

Example

 use toql_core::sql_expr::SqlExpr;

 let mut e = SqlExpr::literal("SELECT ");
 e.push_self_alias();
 e.push_literal("id FROM User ");
 e.push_self_alias();

 assert_eq!("SELECT ..id FROM User ..", e.to_string());

The resolver will replace the self aliases into real aliases and build proper SQL.

Implementations

Create SQL expression from token list.

Create new empty SQL expression.

Create SQL expression from literal.

Create SQL expression from alias.

Create SQL expression from self alias.

Create SQL expression from other alias.

Create SQL expression from unresolved argument.

Create SQL expression from argument.

Create SQL expression from aliased column.

Add literal at the end of token list.

Remove a number of characters -or less- from the end of the list. This affects only the last (literal) token.

Return true if last literal token ends with lit.

Remove last token from list.

Add self alias to the end of the list.

Add other alias to the end of the list.

Add custom alias to the end of the list.

Add argument to the end of the list.

Add unresolved argument to the end of the list.

Returns true, if list is empty.

Returns first auxiliary parameter, if any.

Add a predicate to the end of the list.

Add another SQL expression to the end of the list.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more