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) -> Self
pub fn new(plan: &'a ValidatedPlan, config: &'a DialectConfig) -> Self
Creates a builder for one validated plan and dialect config.
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_expression_to(
&mut self,
expression: &Expression,
buf: &mut String,
) -> Result<(), VlorQLError>
pub fn render_expression_to( &mut self, expression: &Expression, buf: &mut String, ) -> Result<(), VlorQLError>
Renders one expression into buf, avoiding intermediate allocations.
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 render_predicate_to(
&mut self,
predicate: &Predicate,
buf: &mut String,
) -> Result<(), VlorQLError>
pub fn render_predicate_to( &mut self, predicate: &Predicate, buf: &mut String, ) -> Result<(), VlorQLError>
Renders one predicate into buf, avoiding intermediate allocations.
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. Deduplicates parameters: the same (value, data_type) pair always produces the same placeholder index, which PostgreSQL requires for GROUP BY matching.
Sourcepub fn dialect(&self) -> SqlDialect
pub fn dialect(&self) -> SqlDialect
Returns the dialect selected for this builder.
Auto Trait Implementations§
impl<'a> Freeze 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>
impl<'a> UnwindSafe for QueryBuilder<'a>
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