pub struct SelectQuery<'a> {
pub table_name: &'a str,
pub distinct: bool,
pub columns: &'a [&'a str],
pub filters: Option<Vec<Box<dyn BooleanExpression>>>,
pub joins: Option<Vec<Join<'a>>>,
pub sorts: Option<Vec<Sort>>,
pub limit: Option<usize>,
}Fields§
§table_name: &'a str§distinct: bool§columns: &'a [&'a str]§filters: Option<Vec<Box<dyn BooleanExpression>>>§joins: Option<Vec<Join<'a>>>§sorts: Option<Vec<Sort>>§limit: Option<usize>Implementations§
Source§impl<'a> SelectQuery<'a>
impl<'a> SelectQuery<'a>
pub const fn distinct(self) -> Self
pub const fn columns(self, columns: &'a [&'a str]) -> Self
pub fn joins(self, joins: Vec<Join<'a>>) -> Self
pub fn join(self, table_name: &'a str, on: &'a str) -> Self
pub fn left_joins(self, left_joins: Vec<Join<'a>>) -> Self
pub fn left_join(self, table_name: &'a str, on: &'a str) -> Self
pub fn sorts(self, sorts: Vec<Sort>) -> Self
pub fn sort<T>(self, expression: T, direction: SortDirection) -> Selfwhere
T: Into<Identifier>,
pub const fn limit(self, limit: usize) -> Self
Sourcepub async fn execute(self, db: &dyn Database) -> Result<Vec<Row>, DatabaseError>
pub async fn execute(self, db: &dyn Database) -> Result<Vec<Row>, DatabaseError>
§Errors
Will return Err if the select query execution failed.
Sourcepub async fn execute_first(
self,
db: &dyn Database,
) -> Result<Option<Row>, DatabaseError>
pub async fn execute_first( self, db: &dyn Database, ) -> Result<Option<Row>, DatabaseError>
§Errors
Will return Err if the select query execution failed.
Trait Implementations§
Source§impl<'a> Debug for SelectQuery<'a>
impl<'a> Debug for SelectQuery<'a>
Source§impl Expression for SelectQuery<'_>
impl Expression for SelectQuery<'_>
fn expression_type(&self) -> ExpressionType<'_>
fn values(&self) -> Option<Vec<&DatabaseValue>>
fn params(&self) -> Option<Vec<&DatabaseValue>>
fn is_null(&self) -> bool
Source§impl FilterableQuery for SelectQuery<'_>
impl FilterableQuery for SelectQuery<'_>
fn filter(self, filter: Box<dyn BooleanExpression>) -> Self
fn filters(self, filters: Vec<Box<dyn BooleanExpression>>) -> Self
fn filter_if_some<T: BooleanExpression + 'static>( self, filter: Option<T>, ) -> Self
fn where_in<L, V>(self, left: L, values: V) -> Self
fn where_not_in<L, V>(self, left: L, values: V) -> Self
fn where_and(self, conditions: Vec<Box<dyn BooleanExpression>>) -> Self
fn where_or(self, conditions: Vec<Box<dyn BooleanExpression>>) -> Self
fn where_eq<L, R>(self, left: L, right: R) -> Self
fn where_not_eq<L, R>(self, left: L, right: R) -> Self
fn where_gt<L, R>(self, left: L, right: R) -> Self
fn where_gte<L, R>(self, left: L, right: R) -> Self
fn where_lt<L, R>(self, left: L, right: R) -> Self
fn where_lte<L, R>(self, left: L, right: R) -> Self
Source§impl<'a> From<SelectQuery<'a>> for Box<dyn List + 'a>
impl<'a> From<SelectQuery<'a>> for Box<dyn List + 'a>
Source§fn from(val: SelectQuery<'a>) -> Self
fn from(val: SelectQuery<'a>) -> Self
Converts to this type from the input type.
Source§impl<'a> From<UpsertStatement<'a>> for SelectQuery<'a>
impl<'a> From<UpsertStatement<'a>> for SelectQuery<'a>
Source§fn from(value: UpsertStatement<'a>) -> Self
fn from(value: UpsertStatement<'a>) -> Self
Converts to this type from the input type.
impl List for SelectQuery<'_>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for SelectQuery<'a>
impl<'a> !UnwindSafe for SelectQuery<'a>
impl<'a> Freeze for SelectQuery<'a>
impl<'a> Send for SelectQuery<'a>
impl<'a> Sync for SelectQuery<'a>
impl<'a> Unpin for SelectQuery<'a>
impl<'a> UnsafeUnpin for SelectQuery<'a>
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<T> ErasedDestructor for Twhere
T: 'static,
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