pub struct UpdateStatement<'a> {
pub table_name: &'a str,
pub values: Vec<(&'a str, Box<dyn Expression>)>,
pub filters: Option<Vec<Box<dyn BooleanExpression>>>,
pub unique: Option<&'a [&'a str]>,
pub limit: Option<usize>,
}Fields§
§table_name: &'a str§values: Vec<(&'a str, Box<dyn Expression>)>§filters: Option<Vec<Box<dyn BooleanExpression>>>§unique: Option<&'a [&'a str]>§limit: Option<usize>Implementations§
Source§impl<'a> UpdateStatement<'a>
impl<'a> UpdateStatement<'a>
pub fn values<T: Into<Box<dyn Expression>>>( self, values: Vec<(&'a str, T)>, ) -> Self
pub fn value<T: Into<Box<dyn Expression>>>( self, name: &'a str, value: T, ) -> Self
pub const fn unique(self, unique: &'a [&'a str]) -> Self
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 update 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 update execution failed.
Trait Implementations§
Source§impl FilterableQuery for UpdateStatement<'_>
impl FilterableQuery for UpdateStatement<'_>
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
Auto Trait Implementations§
impl<'a> Freeze for UpdateStatement<'a>
impl<'a> !RefUnwindSafe for UpdateStatement<'a>
impl<'a> Send for UpdateStatement<'a>
impl<'a> Sync for UpdateStatement<'a>
impl<'a> Unpin for UpdateStatement<'a>
impl<'a> !UnwindSafe for UpdateStatement<'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
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