pub struct QueryBuilder<'a> { /* private fields */ }Expand description
Builds SQL while preserving the exact textual order of bind parameters.
Implementations§
Source§impl<'a> QueryBuilder<'a>
impl<'a> QueryBuilder<'a>
Sourcepub fn new(
plan: &'a ValidatedPlan,
config: &'a DialectConfig,
) -> Result<Self, VlorQLError>
pub fn new( plan: &'a ValidatedPlan, config: &'a DialectConfig, ) -> Result<Self, VlorQLError>
Creates a builder for one validated plan and dialect config.
§Errors
Returns VlorQLError when config.name does not match any known
SQL dialect.
Sourcepub fn build(self) -> Result<(String, Vec<Parameter>), VlorQLError>
pub fn build(self) -> Result<(String, Vec<Parameter>), VlorQLError>
Builds a SQL string and returns its parameters in placeholder order.
Sourcepub fn render_expression(
&mut self,
expression: &Expression,
) -> Result<String, VlorQLError>
pub fn render_expression( &mut self, expression: &Expression, ) -> Result<String, VlorQLError>
Renders one expression and appends any literal parameters to this builder.
Sourcepub fn render_predicate(
&mut self,
predicate: &Predicate,
) -> Result<String, VlorQLError>
pub fn render_predicate( &mut self, predicate: &Predicate, ) -> Result<String, VlorQLError>
Renders one predicate and appends literal values as bind parameters.
Sourcepub fn add_parameter(&mut self, value: Value, data_type: DataType) -> String
pub fn add_parameter(&mut self, value: Value, data_type: DataType) -> String
Adds a parameter and returns the placeholder for the selected dialect.
Sourcepub fn dialect(&self) -> SqlDialect
pub fn dialect(&self) -> SqlDialect
Returns the dialect selected for this builder.
Auto Trait Implementations§
impl<'a> Forget for QueryBuilder<'a>
impl<'a> Freeze for QueryBuilder<'a>where
&'a ValidatedPlan: Freeze,
&'a DialectConfig: Freeze,
*const u8 is !null: Freeze,
PhantomData<Parameter>: Freeze,
PhantomData<HashMap<String, String>>: Freeze,
PhantomData<((String, DataType), usize)>: Freeze,
impl<'a> Move for QueryBuilder<'a>
impl<'a> RefUnwindSafe for QueryBuilder<'a>
impl<'a> Send for QueryBuilder<'a>
impl<'a> Sync for QueryBuilder<'a>
impl<'a> Unpin for QueryBuilder<'a>
impl<'a> UnsafeUnpin for QueryBuilder<'a>where
&'a ValidatedPlan: UnsafeUnpin,
&'a DialectConfig: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<Parameter>: UnsafeUnpin,
PhantomData<HashMap<String, String>>: UnsafeUnpin,
PhantomData<((String, DataType), usize)>: UnsafeUnpin,
impl<'a> UnwindSafe for QueryBuilder<'a>where
&'a ValidatedPlan: UnwindSafe,
&'a DialectConfig: UnwindSafe,
RawVecInner: UnwindSafe,
BTreeMap<String, Value>: UnwindSafe,
HashMap<String, String>: UnwindSafe,
HashMap<(String, DataType), usize>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request