@@ -2,7 +2,7 @@ use super::{ActiveValue, ActiveValue::*};
22use crate :: {
33 ColumnTrait , Condition , ConnectionTrait , DbBackend , DeleteResult , EntityName , EntityTrait ,
44 IdenStatic , Iterable , PrimaryKeyArity , PrimaryKeyToColumn , PrimaryKeyTrait , QueryFilter ,
5- Related , RelatedSelfVia , RelationDef , RelationTrait , Value ,
5+ Related , RelatedSelfVia , RelationDef , RelationTrait , UpdateResult , Value ,
66 error:: * ,
77 query:: {
88 clear_key_on_active_model, column_tuple_in_condition, get_key_from_active_model,
@@ -345,6 +345,19 @@ pub trait ActiveModelTrait: Clone + Debug {
345345 Self :: after_save ( model, db, false ) . await
346346 }
347347
348+ /// Similar to [`update`], but without returning
349+ /// It also won't execute [`ActiveModelTrait::after_save`]
350+ async fn update_without_returning < ' a , C > ( self , db : & ' a C ) -> Result < UpdateResult , DbErr >
351+ where
352+ Self : ActiveModelBehavior ,
353+ C : ConnectionTrait ,
354+ {
355+ let am = ActiveModelBehavior :: before_save ( self , db, false ) . await ?;
356+ Self :: Entity :: update_without_returning ( am)
357+ . exec_without_returning ( db)
358+ . await
359+ }
360+
348361 /// Insert the model if primary key is `NotSet`, update otherwise.
349362 /// Only works if the entity has auto increment primary key.
350363 async fn save < ' a , C > ( self , db : & ' a C ) -> Result < Self , DbErr >
0 commit comments