Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Changes to user name should match example #47

Merged
merged 2 commits into from
Nov 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions examples/hello-toasty/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ async fn main() {
let schema_file: PathBuf = std::env::current_dir().unwrap().join("schema.toasty");
let schema = toasty::schema::from_file(schema_file).unwrap();

println!("{schema:#?}");
// NOTE enable this to see the enstire structure in STDOUT
// println!("{schema:#?}");

// Use the in-memory sqlite driver
let driver = Sqlite::in_memory();
Expand Down Expand Up @@ -65,8 +66,8 @@ async fn main() {
);

// Load the user again
let user = User::find_by_id(&u2.id).get(&db).await.unwrap();
println!(" reloaded -> {user:#?}");
let user = User::find_by_id(&u1.id).get(&db).await.unwrap();
println!(" reloaded, notice change to the user's name -> {user:#?}");

println!(" ~~~~~~~~~~~ CREATE TODOs ~~~~~~~~~~~~");

Expand Down Expand Up @@ -94,6 +95,7 @@ async fn main() {
// let mut todos = db::Todo::find_by_user(&u2.id).all(&db).await.unwrap();

// Delete user
let user = User::find_by_id(&u2.id).get(&db).await.unwrap();
user.delete(&db).await.unwrap();
assert!(User::find_by_id(&u2.id).get(&db).await.is_err());

Expand Down