Skip to main content

toasty_driver_integration_suite/scenarios/
company_office_address.rs

1use crate::prelude::*;
2
3scenario! {
4    #![id(ID)]
5
6    #[derive(Debug, toasty::Model)]
7    struct Company {
8        #[key]
9        #[auto]
10        id: ID,
11
12        name: String,
13
14        headquarters: Office,
15    }
16
17    #[derive(Debug, toasty::Embed)]
18    struct Office {
19        name: String,
20        address: Address,
21    }
22
23    #[derive(Debug, toasty::Embed)]
24    struct Address {
25        street: String,
26        city: String,
27    }
28
29    async fn setup(test: &mut Test) -> toasty::Db {
30        test.setup_db(models!(Company)).await
31    }
32}