pub struct SelectBuilder { /* private fields */ }Expand description
SELECT query builder
Implementations§
Source§impl SelectBuilder
impl SelectBuilder
Sourcepub fn select_all(self) -> Self
pub fn select_all(self) -> Self
Select all columns
Sourcepub fn add_column(self, column: impl Into<String>) -> Self
pub fn add_column(self, column: impl Into<String>) -> Self
Add a column to select
Sourcepub fn aggregate(
self,
func: AggregateFunc,
column: impl Into<String>,
alias: Option<impl Into<String>>,
) -> Self
pub fn aggregate( self, func: AggregateFunc, column: impl Into<String>, alias: Option<impl Into<String>>, ) -> Self
Add an aggregate function
Sourcepub fn where_clause(self, condition: Condition) -> Self
pub fn where_clause(self, condition: Condition) -> Self
Add a WHERE condition
Sourcepub fn where_eq(self, column: impl Into<String>, value: Value) -> Self
pub fn where_eq(self, column: impl Into<String>, value: Value) -> Self
Add a simple WHERE condition (column = value)
Sourcepub fn where_gt(self, column: impl Into<String>, value: Value) -> Self
pub fn where_gt(self, column: impl Into<String>, value: Value) -> Self
Add a WHERE column > value condition
Sourcepub fn where_lt(self, column: impl Into<String>, value: Value) -> Self
pub fn where_lt(self, column: impl Into<String>, value: Value) -> Self
Add a WHERE column < value condition
Sourcepub fn where_in(self, column: impl Into<String>, values: Vec<Value>) -> Self
pub fn where_in(self, column: impl Into<String>, values: Vec<Value>) -> Self
Add a WHERE column IN (…) condition
Sourcepub fn where_null(self, column: impl Into<String>) -> Self
pub fn where_null(self, column: impl Into<String>) -> Self
Add a WHERE column IS NULL condition
Sourcepub fn where_like(
self,
column: impl Into<String>,
pattern: impl Into<String>,
) -> Self
pub fn where_like( self, column: impl Into<String>, pattern: impl Into<String>, ) -> Self
Add a WHERE column LIKE pattern condition
Sourcepub fn join(
self,
join_type: JoinType,
table: impl Into<String>,
on: Condition,
) -> Self
pub fn join( self, join_type: JoinType, table: impl Into<String>, on: Condition, ) -> Self
Add a JOIN clause
Sourcepub fn inner_join(self, table: impl Into<String>, on: Condition) -> Self
pub fn inner_join(self, table: impl Into<String>, on: Condition) -> Self
Add an INNER JOIN
Sourcepub fn order_by(
self,
column: impl Into<String>,
direction: SortDirection,
) -> Self
pub fn order_by( self, column: impl Into<String>, direction: SortDirection, ) -> Self
Add ORDER BY
Sourcepub fn order_desc(self, column: impl Into<String>) -> Self
pub fn order_desc(self, column: impl Into<String>) -> Self
Add descending ORDER BY
Trait Implementations§
Source§impl Clone for SelectBuilder
impl Clone for SelectBuilder
Source§fn clone(&self) -> SelectBuilder
fn clone(&self) -> SelectBuilder
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 moreAuto Trait Implementations§
impl Freeze for SelectBuilder
impl RefUnwindSafe for SelectBuilder
impl Send for SelectBuilder
impl Sync for SelectBuilder
impl Unpin for SelectBuilder
impl UnwindSafe for SelectBuilder
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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