Improve postgres example code style
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
This commit is contained in:
parent
55af1e97d2
commit
de8ca02048
@ -96,10 +96,10 @@ fn main() {
|
||||
.set(&user4)
|
||||
.expect("can set user");
|
||||
|
||||
println!("User 1 assigned ID: {}", user1_id);
|
||||
println!("User 2 assigned ID: {}", user2_id);
|
||||
println!("User 3 assigned ID: {}", user3_id);
|
||||
println!("User 4 assigned ID: {}", user4_id);
|
||||
println!("User 1 assigned ID: {user1_id}");
|
||||
println!("User 2 assigned ID: {user2_id}");
|
||||
println!("User 3 assigned ID: {user3_id}");
|
||||
println!("User 4 assigned ID: {user4_id}");
|
||||
|
||||
// We already have the updated models from the set method, so we don't need to retrieve them again
|
||||
|
||||
@ -140,14 +140,14 @@ fn main() {
|
||||
.expect("can load stored users");
|
||||
|
||||
assert_eq!(active_users.len(), 2);
|
||||
for (_i, active_user) in active_users.iter().enumerate() {
|
||||
for active_user in active_users.iter() {
|
||||
print_user_details(active_user);
|
||||
}
|
||||
|
||||
// 3. Delete a user and show the updated results
|
||||
println!("\n3. After Deleting a User:");
|
||||
let user_to_delete_id = active_users[0].get_id();
|
||||
println!("Deleting user with ID: {}", user_to_delete_id);
|
||||
println!("Deleting user with ID: {user_to_delete_id}");
|
||||
db.collection::<User>()
|
||||
.expect("can open user collection")
|
||||
.delete_by_id(user_to_delete_id)
|
||||
@ -162,7 +162,7 @@ fn main() {
|
||||
|
||||
println!(" a. Remaining Active Users:");
|
||||
assert_eq!(active_users.len(), 1);
|
||||
for (_i, active_user) in active_users.iter().enumerate() {
|
||||
for active_user in active_users.iter() {
|
||||
print_user_details(active_user);
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ fn main() {
|
||||
|
||||
println!(" b. Inactive Users:");
|
||||
assert_eq!(inactive_users.len(), 2);
|
||||
for (_i, inactive_user) in inactive_users.iter().enumerate() {
|
||||
for inactive_user in inactive_users.iter() {
|
||||
print_user_details(inactive_user);
|
||||
}
|
||||
|
||||
@ -199,7 +199,7 @@ fn main() {
|
||||
.set(&comment)
|
||||
.expect("can set comment");
|
||||
|
||||
println!("Comment assigned ID: {}", comment_id);
|
||||
println!("Comment assigned ID: {comment_id}");
|
||||
|
||||
println!(" a. Comment Retrieved from Database:");
|
||||
print_comment_details(&db_comment);
|
||||
|
Loading…
Reference in New Issue
Block a user