Skip to content

Commit

Permalink
Incorporate fixes in PR #47
Browse files Browse the repository at this point in the history
  • Loading branch information
bsodmike committed Nov 2, 2024
1 parent 7cf2aa9 commit 7495566
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/target
/Cargo.lock
/examples/hello-toasty-rustqlite/*.sql
/examples/hello-toasty-rustqlite/*.db3
Binary file added examples/hello-toasty-rustqlite/sqlite_db.sql
Binary file not shown.
7 changes: 4 additions & 3 deletions examples/hello-toasty-rustqlite/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async fn main() {
// println!("{schema:#?}");

// Use rustqlite as the driver, creating a file locally in `./`
let filename = "sqlite_db.sql";
let filename = "toasty.db3";
let file_path = format!("./{}", filename);
let file = PathBuf::from(file_path.as_str());
let driver = Sqlite::open(file).unwrap();
Expand Down Expand Up @@ -81,8 +81,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 @@ -110,6 +110,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

0 comments on commit 7495566

Please sign in to comment.