pub trait UpdateBuilder {
// Required methods
fn set<T: ToSQLData>(self, column: &str, new_value: T) -> Self;
fn where_in<T: ToSQLData>(self, column: &str, values: Vec<T>) -> WhereUpdate;
fn where_not<T: ToSQLData>(
self,
column: &str,
values: Vec<T>,
) -> WhereUpdate;
fn build(self) -> Result<(), Error>;
fn build_return_count(self) -> Result<usize, Error>;
}
Required Methods§
Sourcefn where_in<T: ToSQLData>(self, column: &str, values: Vec<T>) -> WhereUpdate
fn where_in<T: ToSQLData>(self, column: &str, values: Vec<T>) -> WhereUpdate
Adds a WHERE clause to your query.
conn.update("test_grades")
.set("passed", "false")
.where_in("name", vec!["John Doe", "Jane Smith"])
.build()?;
Is the same as:
UPDATE test_grades
SET passed = 'false'
WHERE name NOT IN ('John Doe');
Sourcefn where_not<T: ToSQLData>(self, column: &str, values: Vec<T>) -> WhereUpdate
fn where_not<T: ToSQLData>(self, column: &str, values: Vec<T>) -> WhereUpdate
Adds a WHERE NOT clause to your query.
conn.update("test_grades")
.set("passed", "true")
.where_not("name", vec!["John Doe", "Jane Smith"])
.build()?;
Is the same as:
UPDATE test_grades
SET passed = 'true'
WHERE name NOT IN ('John Doe');
Sourcefn build_return_count(self) -> Result<usize, Error>
fn build_return_count(self) -> Result<usize, Error>
Builds the query and returns the number of row updated.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.