Django user here. I switching to Actix written in rust. How to add or subtract 1 from existed value in database. I have function
post.vote = ActiveValue::Set(post.vote.into_wrapped_value() + 1);
and also tried
post.vote = ActiveValue::Set(post.vote.take() + 1);
But i get error cannot subtract {integer} from std::option::Option<i32>
post.vote = ActiveValue::Set(<sea_orm::ActiveValue<i32> as Into<T>>::into(post.vote) + 1);
Cannot find type T in this scope
so i add to <T> to --> impl<T> PostRepository {
the type parameter T is not constrained by the impl trait, self type, or predicates
unconstrained type parameter
Any hint
From documents https://www.sea-ql.org/SeaORM/docs/basic-crud/update/ People can first query exist value from database and then update it.
In your case, the codes could be like: