mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
16 lines
435 B
Rust
16 lines
435 B
Rust
|
#[macro_export]
|
||
|
macro_rules! diesel_update_table {
|
||
|
(
|
||
|
$table_name:ident,
|
||
|
$changeset:ident,
|
||
|
$connection:ident
|
||
|
) => {
|
||
|
let filter =
|
||
|
$table_name::dsl::$table_name.filter($table_name::dsl::id.eq($changeset.id.clone()));
|
||
|
let affected_row = diesel::update(filter)
|
||
|
.set($changeset)
|
||
|
.execute(&*$connection)?;
|
||
|
debug_assert_eq!(affected_row, 1);
|
||
|
};
|
||
|
}
|