pub struct QueryBuilder { /* private fields */ }Expand description
A builder for constructing database Queryes.
Implementations§
Source§impl QueryBuilder
impl QueryBuilder
Sourcepub fn build(self) -> Query
pub fn build(self) -> Query
Builds and returns a Query object based on the current state of the QueryBuilder.
Sourcepub fn fields<I>(self, fields: I) -> Selfwhere
I: IntoIterator<Item = &'static str>,
pub fn fields<I>(self, fields: I) -> Selfwhere
I: IntoIterator<Item = &'static str>,
Adds multiple fields to select in the query.
Sourcepub fn with(self, table_relation: &str) -> Self
pub fn with(self, table_relation: &str) -> Self
Adds a relation to eagerly load with the main records.
Sourcepub fn inner_join(self, table: &str, left_col: &str, right_col: &str) -> Self
pub fn inner_join(self, table: &str, left_col: &str, right_col: &str) -> Self
Adds an INNER JOIN operation to this query
Sourcepub fn left_join(self, table: &str, left_col: &str, right_col: &str) -> Self
pub fn left_join(self, table: &str, left_col: &str, right_col: &str) -> Self
Adds a LEFT JOIN operation to this query
Sourcepub fn right_join(self, table: &str, left_col: &str, right_col: &str) -> Self
pub fn right_join(self, table: &str, left_col: &str, right_col: &str) -> Self
Adds a RIGHT JOIN operation to this query
Sourcepub fn full_join(self, table: &str, left_col: &str, right_col: &str) -> Self
pub fn full_join(self, table: &str, left_col: &str, right_col: &str) -> Self
Adds a FULL JOIN operation to this query
Sourcepub fn order_by_asc(self, field: &str) -> Self
pub fn order_by_asc(self, field: &str) -> Self
Adds an ascending order by clause for the specified field.
Sourcepub fn order_by_desc(self, field: &str) -> Self
pub fn order_by_desc(self, field: &str) -> Self
Adds a descending order by clause for the specified field.
Sourcepub fn filter(self, filter: Option<Filter>) -> Self
pub fn filter(self, filter: Option<Filter>) -> Self
Sets a filter for the query, replacing any existing filter.
Trait Implementations§
Source§impl Clone for QueryBuilder
impl Clone for QueryBuilder
Source§fn clone(&self) -> QueryBuilder
fn clone(&self) -> QueryBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for QueryBuilder
impl Debug for QueryBuilder
Source§impl Default for QueryBuilder
impl Default for QueryBuilder
Source§fn default() -> QueryBuilder
fn default() -> QueryBuilder
Returns the “default value” for a type. Read more
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