Skip to main content

toasty_driver_integration_suite/scenarios/
user_contact_info.rs

1use crate::prelude::*;
2
3scenario! {
4    #[derive(Debug, toasty::Model)]
5    #[allow(dead_code)]
6    struct User {
7        #[key]
8        #[auto]
9        id: uuid::Uuid,
10
11        name: String,
12
13        contact: ContactInfo,
14    }
15
16    #[derive(Debug, PartialEq, toasty::Embed)]
17    enum ContactInfo {
18        #[column(variant = 1)]
19        Email { address: String },
20        #[column(variant = 2)]
21        Phone { number: String },
22    }
23
24    async fn setup(test: &mut Test) -> toasty::Db {
25        test.setup_db(models!(User)).await
26    }
27}