pub struct QueryBuilder<'a, T, DB: Database> { /* private fields */ }Implementations§
Source§impl<'a, T, DB> QueryBuilder<'a, T, DB>where
DB: SqlDialect,
T: Model<DB>,
impl<'a, T, DB> QueryBuilder<'a, T, DB>where
DB: SqlDialect,
T: Model<DB>,
pub fn new(executor: Executor<'a, DB>) -> Self
pub fn filter(self, condition: impl Into<String>) -> Self
pub fn filter_raw(self, condition: impl Into<String>) -> Self
pub fn filter_eq(self, column: &str, value: impl Into<BindValue>) -> Self
pub fn filter_ne(self, column: &str, value: impl Into<BindValue>) -> Self
pub fn filter_lt(self, column: &str, value: impl Into<BindValue>) -> Self
pub fn filter_lte(self, column: &str, value: impl Into<BindValue>) -> Self
pub fn filter_gt(self, column: &str, value: impl Into<BindValue>) -> Self
pub fn filter_gte(self, column: &str, value: impl Into<BindValue>) -> Self
pub fn filter_like(self, column: &str, value: impl Into<BindValue>) -> Self
pub fn filter_is_null(self, column: &str) -> Self
pub fn filter_is_not_null(self, column: &str) -> Self
pub fn filter_in<I, V>(self, column: &str, values: I) -> Selfwhere
I: IntoIterator<Item = V>,
V: Into<BindValue>,
pub fn limit(self, limit: i32) -> Self
pub fn offset(self, offset: i32) -> Self
pub fn include(self, relation: impl Into<String>) -> Self
pub fn with_deleted(self) -> Self
pub fn allow_unsafe(self) -> Self
Sourcepub fn to_update_sql(&self, values: &Value) -> Result<String, Error>
pub fn to_update_sql(&self, values: &Value) -> Result<String, Error>
Returns the UPDATE SQL that would be executed for this query.
Sourcepub fn to_delete_sql(&self) -> String
pub fn to_delete_sql(&self) -> String
Returns the DELETE (or soft delete) SQL that would be executed for this query.
Source§impl<'a, T, DB> QueryBuilder<'a, T, DB>where
DB: SqlDialect,
T: Model<DB> + Send,
for<'q> <DB as Database>::Arguments<'q>: IntoArguments<'q, DB>,
for<'c> &'c mut <DB as Database>::Connection: SqlxExecutor<'c, Database = DB>,
for<'c> &'c str: ColumnIndex<DB::Row>,
DB::Connection: Send,
String: for<'q> Encode<'q, DB> + Type<DB>,
i64: for<'q> Encode<'q, DB> + Type<DB>,
f64: for<'q> Encode<'q, DB> + Type<DB>,
bool: for<'q> Encode<'q, DB> + Type<DB>,
Option<String>: for<'q> Encode<'q, DB> + Type<DB>,
impl<'a, T, DB> QueryBuilder<'a, T, DB>where
DB: SqlDialect,
T: Model<DB> + Send,
for<'q> <DB as Database>::Arguments<'q>: IntoArguments<'q, DB>,
for<'c> &'c mut <DB as Database>::Connection: SqlxExecutor<'c, Database = DB>,
for<'c> &'c str: ColumnIndex<DB::Row>,
DB::Connection: Send,
String: for<'q> Encode<'q, DB> + Type<DB>,
i64: for<'q> Encode<'q, DB> + Type<DB>,
f64: for<'q> Encode<'q, DB> + Type<DB>,
bool: for<'q> Encode<'q, DB> + Type<DB>,
Option<String>: for<'q> Encode<'q, DB> + Type<DB>,
pub async fn all(self) -> Result<Vec<T>, Error>
pub async fn update(self, values: Value) -> Result<u64, Error>
pub async fn update_all(self, values: Value) -> Result<u64, Error>
pub async fn delete(self) -> Result<u64, Error>
pub async fn delete_all(self) -> Result<u64, Error>
Auto Trait Implementations§
impl<'a, T, DB> Freeze for QueryBuilder<'a, T, DB>
impl<'a, T, DB> !RefUnwindSafe for QueryBuilder<'a, T, DB>
impl<'a, T, DB> Send for QueryBuilder<'a, T, DB>where
T: Send,
impl<'a, T, DB> Sync for QueryBuilder<'a, T, DB>
impl<'a, T, DB> Unpin for QueryBuilder<'a, T, DB>where
T: Unpin,
impl<'a, T, DB> !UnwindSafe for QueryBuilder<'a, T, DB>
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