Creating, Updating, and Deleting Records
See Fetching Data
in the routing guide for how to obtain a reference to the application-wide Store.
Creating Records
Use Store::create_record() to create a record.
use crate::models::customer::Customer;
let customer = Customer{
name: "Acme Widgets".to_string(),
..Default::default()
};
let finalized_customer = store.create_record("customer", &customer).await?;
log::info!("The assigned customer id is {}", finalized_customer.id);
Updating Records
TODO
Deleting Records
Use Store::delete_record() to delete a record:
use crate::models::customer::Customer;
let customer: Customer = store.find_record("customer", "123", None).await?;
store.delete_record(&customer).await?;