pub struct QueryBuilder { /* private fields */ }Expand description
SQL query builder with parameterized queries and JOIN support
Implementations§
Source§impl QueryBuilder
impl QueryBuilder
pub fn new(table: &str) -> Self
Sourcepub fn where_eq(self, field: &str, value: QueryValue) -> Self
pub fn where_eq(self, field: &str, value: QueryValue) -> Self
Add WHERE field = ? condition (parameterized)
Sourcepub fn where_ne(self, field: &str, value: QueryValue) -> Self
pub fn where_ne(self, field: &str, value: QueryValue) -> Self
Add WHERE field != ? condition (parameterized)
Sourcepub fn where_gt(self, field: &str, value: QueryValue) -> Self
pub fn where_gt(self, field: &str, value: QueryValue) -> Self
Add WHERE field > ? condition (parameterized)
Sourcepub fn where_lt(self, field: &str, value: QueryValue) -> Self
pub fn where_lt(self, field: &str, value: QueryValue) -> Self
Add WHERE field < ? condition (parameterized)
Sourcepub fn where_like(self, field: &str, value: QueryValue) -> Self
pub fn where_like(self, field: &str, value: QueryValue) -> Self
Add WHERE field LIKE ? condition (parameterized)
Sourcepub fn where_in(self, field: &str, values: Vec<QueryValue>) -> Self
pub fn where_in(self, field: &str, values: Vec<QueryValue>) -> Self
Add WHERE field IN (?) condition (parameterized)
Sourcepub fn join(self, join_type: JoinType, table: &str, on_condition: &str) -> Self
pub fn join(self, join_type: JoinType, table: &str, on_condition: &str) -> Self
Add JOIN clause
Sourcepub fn join_alias(
self,
join_type: JoinType,
table: &str,
alias: &str,
on_condition: &str,
) -> Self
pub fn join_alias( self, join_type: JoinType, table: &str, alias: &str, on_condition: &str, ) -> Self
Add JOIN clause with table alias
Sourcepub fn where_raw(self, condition: &str, param: QueryValue) -> Self
pub fn where_raw(self, condition: &str, param: QueryValue) -> Self
Add raw WHERE condition (for complex conditions)
Sourcepub fn build_query(&self) -> (String, Vec<QueryValue>)
pub fn build_query(&self) -> (String, Vec<QueryValue>)
Build query with parameters for execution
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
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> 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> ⓘ
Converts
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> ⓘ
Converts
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