It would be great to have a method that replace the content of a DbState struct to another (as long as the PK is the same). This would allow easy overwrite of rows without mapping each fields to the other, potentially forgetting some in the process.
For example:
let mut old_data = Foo::find_by_id(&client, 1).await?; // Returns Foo { id: 1, val: 33 }
let new_data = Foo { id: 1, val: 42 }
old_data.replace_inner(new_data) // Set the value to Foo { id: 1, val: 42 }, and DbStatus to Edited.
old_data.save(&client).await?; // Just save it now!
It would be great to have a method that replace the content of a DbState struct to another (as long as the PK is the same). This would allow easy overwrite of rows without mapping each fields to the other, potentially forgetting some in the process.
For example: