pub struct QB<T: Debug> {
pub base: TableInfo,
pub eager: Vec<JoinSpec>,
pub batch: Vec<JoinSpec>,
pub filters: Vec<Condition>,
/* private fields */
}
Expand description
Query builder for composing SELECT statements with optional joins and filters.
Fields§
§base: TableInfo
Base table information and selected columns.
eager: Vec<JoinSpec>
Eager joins that project columns from related tables.
batch: Vec<JoinSpec>
Batch joins for has-many relations.
filters: Vec<Condition>
WHERE clause conditions combined with AND.
Implementations§
Source§impl<T: Debug> QB<T>
impl<T: Debug> QB<T>
pub fn new(base: TableInfo) -> QB<T>
pub fn join_eager(self, spec: JoinSpec) -> Self
pub fn join_batch(self, spec: JoinSpec) -> Self
pub fn select<'a, Out: Debug + FromRow<'a, Row>>( self, cols: Vec<&'static str>, ) -> QB<Out>
pub fn filter(self, cond: Condition) -> Self
pub fn build_query(&self) -> QueryBuilder<'static, Driver>
pub fn to_sql(&self) -> String
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for QB<T>
impl<T> !RefUnwindSafe for QB<T>
impl<T> Send for QB<T>where
T: Send,
impl<T> Sync for QB<T>where
T: Sync,
impl<T> Unpin for QB<T>where
T: Unpin,
impl<T> !UnwindSafe for QB<T>
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
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