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

The resolver may hold values for placeholder tokens from SqlExpr and replace those.

It will replace placeholder tokens from SqlExpr with concret values as good as it can.

This is a typical use:

use toql_core::{sql_expr::SqlExpr, alias_format::AliasFormat};
use toql_core::{alias_translator::AliasTranslator, sql_expr::resolver::Resolver};

let sql_expr = SqlExpr::self_alias();
let mut alias_translator = AliasTranslator::new(AliasFormat::TinyIndex);
let resolver = Resolver::new().with_self_alias("t1");

let sql = resolver.to_sql(&sql_expr, &mut alias_translator).unwrap();
assert_eq!("t1", sql.to_unsafe_string());

Implementations

Replace self alias placeholders with this alias.

Replace other alias placeholders with this alias.

Replace aux param placeholders with values from this map.

Replace argument placeholder with values from this argument list.

Replace aux param palceholders with SQL expressions. Skips placeholders that can’t be replaced.

Resolve aux params placeholders with value from parameter map. Skips placeholders that cannot be resolved.

Resolve all aliases to literal strings.

Resolve all placeholder tokens and translate aliases with the AliasTranslator. This turns an SqlExpr into Sql, if all placeholder tokens can be resolved and fail otherwise.

Trait Implementations

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

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 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