pub struct QueryBuilder { /* private fields */ }Expand description
Incrementally build a SQL query with bound parameters.
Implementations§
Source§impl QueryBuilder
impl QueryBuilder
Sourcepub fn push_bind<T: Encode>(&mut self, value: &T) -> Result<()>
pub fn push_bind<T: Encode>(&mut self, value: &T) -> Result<()>
Add a positional bind parameter and append the placeholder.
Sourcepub fn push_bind_named<T: Encode>(
&mut self,
name: &str,
value: &T,
) -> Result<()>
pub fn push_bind_named<T: Encode>( &mut self, name: &str, value: &T, ) -> Result<()>
Add a named bind parameter and append the placeholder.
Sourcepub fn push_values<I, T>(&mut self, iter: I) -> Result<()>where
I: IntoIterator<Item = T>,
T: Encode,
pub fn push_values<I, T>(&mut self, iter: I) -> Result<()>where
I: IntoIterator<Item = T>,
T: Encode,
Append a comma-separated list of bound values.
Sourcepub fn push_idents<I>(&mut self, iter: I) -> Result<()>
pub fn push_idents<I>(&mut self, iter: I) -> Result<()>
Append a comma-separated list of quoted identifiers.
Sourcepub fn push_insert(&mut self, values: &Values) -> Result<()>
pub fn push_insert(&mut self, values: &Values) -> Result<()>
Append an INSERT column/value list from provided values.
Sourcepub fn push_set(&mut self, values: &Values) -> Result<()>
pub fn push_set(&mut self, values: &Values) -> Result<()>
Append a SET clause from provided values.
Sourcepub fn push_where(&mut self, values: &Values) -> Result<()>
pub fn push_where(&mut self, values: &Values) -> Result<()>
Append a WHERE clause from provided values.
Sourcepub fn push_upsert(&mut self, values: &Values, exclude: &[&str]) -> Result<()>
pub fn push_upsert(&mut self, values: &Values, exclude: &[&str]) -> Result<()>
Append an UPSERT update clause, excluding the named columns.
Sourcepub fn push_query(&mut self, query: Query)
pub fn push_query(&mut self, query: Query)
Appends another Query to this builder.
The SQL of the provided query is appended to this builder with a single space in between if needed. All arguments from the other query are merged and indices for named parameters are re-based to ensure they refer to the correct values.
This method panics if the appended query contains numeric positional
placeholders such as ?1 or numeric $1. Use
QueryBuilder::try_push_query to handle unsupported composition as
an error.
Sourcepub fn try_push_query(&mut self, query: Query) -> Result<()>
pub fn try_push_query(&mut self, query: Query) -> Result<()>
Attempt to append another Query to this builder.
Numeric positional placeholders such as ?1 and numeric $1 are
rejected in appended fragments because their absolute SQLite indices
cannot be safely rebased by the current composition machinery.
Trait Implementations§
Source§impl Default for QueryBuilder
impl Default for QueryBuilder
Source§fn default() -> QueryBuilder
fn default() -> QueryBuilder
Auto Trait Implementations§
impl Freeze for QueryBuilder
impl RefUnwindSafe for QueryBuilder
impl Send for QueryBuilder
impl Sync for QueryBuilder
impl Unpin for QueryBuilder
impl UnsafeUnpin for QueryBuilder
impl UnwindSafe for QueryBuilder
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
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more