|
@@ -15,7 +15,7 @@ struct Subject {
|
|
|
|
|
|
#[derive(Entity)]
|
|
|
struct Verb {
|
|
|
- written: String
|
|
|
+ written: String,
|
|
|
}
|
|
|
|
|
|
#[derive(Default, Schema)]
|
|
@@ -48,21 +48,48 @@ fn nested() {
|
|
|
let (pool, db): (_, CombinedSchema) = common::open_test_db!();
|
|
|
let mut lease = pool.acquire().unwrap();
|
|
|
|
|
|
- let obj_id = db.dictionary.objects.insert(&mut lease, Object {
|
|
|
- written: String::from("an_object")
|
|
|
- }).expect("couldn't insert object");
|
|
|
+ let obj_id = db
|
|
|
+ .dictionary
|
|
|
+ .objects
|
|
|
+ .insert(
|
|
|
+ &mut lease,
|
|
|
+ Object {
|
|
|
+ written: String::from("an_object"),
|
|
|
+ },
|
|
|
+ )
|
|
|
+ .expect("couldn't insert object");
|
|
|
|
|
|
- let subj_id = db.dictionary.subjects.insert(&mut lease, Subject {
|
|
|
- written: String::from("a_subject")
|
|
|
- }).expect("couldn't insert subject");
|
|
|
+ let subj_id = db
|
|
|
+ .dictionary
|
|
|
+ .subjects
|
|
|
+ .insert(
|
|
|
+ &mut lease,
|
|
|
+ Subject {
|
|
|
+ written: String::from("a_subject"),
|
|
|
+ },
|
|
|
+ )
|
|
|
+ .expect("couldn't insert subject");
|
|
|
|
|
|
- let verb_id = db.dictionary.verbs.insert(&mut lease, Verb {
|
|
|
- written: String::from("verb1")
|
|
|
- }).expect("couldn't insert verb");
|
|
|
+ let verb_id = db
|
|
|
+ .dictionary
|
|
|
+ .verbs
|
|
|
+ .insert(
|
|
|
+ &mut lease,
|
|
|
+ Verb {
|
|
|
+ written: String::from("verb1"),
|
|
|
+ },
|
|
|
+ )
|
|
|
+ .expect("couldn't insert verb");
|
|
|
|
|
|
- db.sentence.sentences.insert(&mut lease, Sentence {
|
|
|
- object: obj_id,
|
|
|
- subject: subj_id,
|
|
|
- verb: verb_id,
|
|
|
- }).expect("couldn't insert sentence");
|
|
|
+ db.sentence
|
|
|
+ .sentences
|
|
|
+ .insert(
|
|
|
+ &mut lease,
|
|
|
+ Sentence {
|
|
|
+ object: obj_id,
|
|
|
+ subject: subj_id,
|
|
|
+ verb: verb_id,
|
|
|
+ },
|
|
|
+ )
|
|
|
+ .expect("couldn't insert sentence");
|
|
|
}
|