fmt, fixes and additions
This commit is contained in:
@@ -59,21 +59,39 @@ fn main() {
|
||||
println!("Before saving - SimpleUser DB Keys: {:?}", user.db_keys());
|
||||
|
||||
println!("\nBefore saving - CustomUser ID: {}", custom_user.get_id());
|
||||
println!("Before saving - CustomUser DB Keys: {:?}", custom_user.db_keys());
|
||||
println!(
|
||||
"Before saving - CustomUser DB Keys: {:?}",
|
||||
custom_user.db_keys()
|
||||
);
|
||||
|
||||
// Save the models to the database
|
||||
let simple_collection = db.collection::<SimpleUser>().expect("can open simple user collection");
|
||||
let custom_collection = db.collection::<CustomUser>().expect("can open custom user collection");
|
||||
let simple_collection = db
|
||||
.collection::<SimpleUser>()
|
||||
.expect("can open simple user collection");
|
||||
let custom_collection = db
|
||||
.collection::<CustomUser>()
|
||||
.expect("can open custom user collection");
|
||||
|
||||
let (user_id, saved_user) = simple_collection.set(&user).expect("can save simple user");
|
||||
let (custom_user_id, saved_custom_user) = custom_collection.set(&custom_user).expect("can save custom user");
|
||||
let (custom_user_id, saved_custom_user) = custom_collection
|
||||
.set(&custom_user)
|
||||
.expect("can save custom user");
|
||||
|
||||
println!("\nAfter saving - SimpleUser ID: {}", saved_user.get_id());
|
||||
println!("After saving - SimpleUser DB Keys: {:?}", saved_user.db_keys());
|
||||
println!(
|
||||
"After saving - SimpleUser DB Keys: {:?}",
|
||||
saved_user.db_keys()
|
||||
);
|
||||
println!("Returned SimpleUser ID: {}", user_id);
|
||||
|
||||
println!("\nAfter saving - CustomUser ID: {}", saved_custom_user.get_id());
|
||||
println!("After saving - CustomUser DB Keys: {:?}", saved_custom_user.db_keys());
|
||||
println!(
|
||||
"\nAfter saving - CustomUser ID: {}",
|
||||
saved_custom_user.get_id()
|
||||
);
|
||||
println!(
|
||||
"After saving - CustomUser DB Keys: {:?}",
|
||||
saved_custom_user.db_keys()
|
||||
);
|
||||
println!("Returned CustomUser ID: {}", custom_user_id);
|
||||
|
||||
// Verify that the IDs were auto-generated
|
||||
@@ -83,5 +101,8 @@ fn main() {
|
||||
assert_ne!(saved_custom_user.get_id(), 0);
|
||||
|
||||
println!("\nExample finished. DB stored at {}", db_path);
|
||||
println!("To clean up, you can manually delete the directory: {}", db_path);
|
||||
println!(
|
||||
"To clean up, you can manually delete the directory: {}",
|
||||
db_path
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user