Search⌘ K
AI Features

Update and Delete Resources

Explore how to update and delete database resources in Rust web applications. Learn to use helper structs with AsChangeset for efficient updates and implement cascading deletes using SQL to maintain database integrity. This lesson includes practical testing techniques to ensure reliable data manipulation.

We'll cover the following...

Update

Updating a resource might be a bit tricky, so we’re going to need a few helper structs. We’ll use the annotation AsChangeset for the struct we directly modify in the database.

We have the option to refactor the structs used for inserting, but in our case, we’ll create new ones for this purpose. ...