pub trait ModelUpdate: Model {
// Required method
fn update(self, conn: &mut SqliteConnection) -> QueryResult<Self>;
// Provided method
fn update_all(
conn: &mut SqliteConnection,
items: Vec<Self>,
) -> QueryResult<Vec<Self>> { ... }
}Expand description
A trait for models that support update operations.
This trait extends the Model trait and provides methods for updating
individual and multiple records.
§Methods
update: Updates an existing record in the database table.update_all: Updates multiple records in the database table.
Required Methods§
Sourcefn update(self, conn: &mut SqliteConnection) -> QueryResult<Self>
fn update(self, conn: &mut SqliteConnection) -> QueryResult<Self>
Provided Methods§
Sourcefn update_all(
conn: &mut SqliteConnection,
items: Vec<Self>,
) -> QueryResult<Vec<Self>>
fn update_all( conn: &mut SqliteConnection, items: Vec<Self>, ) -> QueryResult<Vec<Self>>
Updates multiple records in the database table.
Apply updates in input order within one transaction. A failure rolls back the entire batch.
§Arguments
conn: A mutable reference to the database connection.items: A vector of records to update.
§Returns
A QueryResult containing a vector of updated records.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".